So I debug 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

Afficher le fil de discussion

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.

Afficher le fil de discussion

But this the payload wasn't huge like the other time, only some variables like 30 of them.

Afficher le fil de discussion

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" api.mailjet.com/v3.1/send -H 'Content-Type: application/json' -d @not_working_payload@twitter.activitypub.actor.json"

Afficher le fil de discussion

If you didn't notice yet, my template variables contains some variables from itself. From their webhook API. Like

"mj_contact_id": 2990057017
"MessageID": 2.88230382242937e+17

Afficher le fil de discussion
Suivre

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.
cplusplus.com/reference/string

SO THE FUCK WAS THAT 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

Afficher le fil de discussion
Inscrivez-vous pour prendre part à la conversation
HugoPoi's Instance

Le réseau social de l'avenir : Pas d'annonces, pas de surveillance institutionnelle, conception éthique et décentralisation ! Possédez vos données avec Mastodon !