So I debug #Mailjet API myself and it's VERY funny,
First the error message :
"A template language occurred when sending a message using Template 2360961: stoi"
That's all.
So first you need to dig in your template for finding weirdiness, but I'm used to other errors of Mailjet, that's not looking like a regular error message.
A regular error message look like this
Sometimes ago, I had a similar error but after looking at my sended payload, my code sended huge payload to Mailjet with too many Variables for the template, at this time, I fix the issue by just sending what I needed, and it fix the problem.
So I start to reproduce the issue.
So I start to narrow the problem with a simple technique : Dichotomy, You take the payload and you half it after each try.
I used
"curl -s -X POST --user "$MJ_API_KEY:$MJ_API_PASS" https://api.mailjet.com/v3.1/send -H 'Content-Type: application/json' -d @not_working_payload@twitter.activitypub.actor.json"
Then the meaning of "stoi" make a little more sense, it must mean StringToInteger related error.
As stoi is a common function in C, C++ for parsing a string to a int value.
https://www.cplusplus.com/reference/string/stoi/
SO THE FUCK WAS THAT #MAILJET doesn't handle their ids as integer during the parsing of the incoming API calls.
You can crash the API with the "stoi" error just by sending this to Mailjet API
If you didn't notice yet, my template variables contains some variables from #Mailjet itself. From their webhook API. Like
"mj_contact_id": 2990057017
"MessageID": 2.88230382242937e+17