Hey @Doug Taylor Eden from the support engineer team here.
Can you please try removing the line breaks from your request in the Custom Action, then try to send the request again? So instead of using the format of:
{“name”: “test name”,
“project_id”: 1
}
Formatting the request like:
{“name”: “test name”, “project_id”: 1}
If that doesn’t resolve this issue for you, I can go ahead and escalate this with our Support team for a deeper investigation.
After playing around with this more, I’m still having trouble, but I noticed that there is something weird with the way Custom Builder is handling JSON.
JSON is typically formatted as
{
"key":"value"
}
That’s how I format it in Postman for my tests, which work. That’s how I originally formatted it here in Intercom, which failed.
After playing around, I found that Intercom seems to want it formatted like this instead
key="text value"
No brackets, no quotes around the key. Quotes for text values, but no quotes for integer values. Very weird.
So, my original request body in Intercom was this:
{"name": "Just a test card from Intercom",
"project_id": "2116",
"story_type": "bug"
}
This works fine in Postman and any other testing tool, but in Intercom I was getting a response from Shortcut that it was missing “name”, a required key. Weird, since that was provided.
If I format it like this:
name="Test card from Intercom",
project_id=2116,
story_type="bug"
I no longer get an error about missing the “name” key. Instead, I get an error about needing a “project id”.
So, it looks like Intercom is wanting JSON formatted with no brackets as key=”value”, but the problem is, I’m still running into issues because only the first item (name) appears to be recognized by Shortcut.
This isn’t an issue with Shortcut’s API, because this works just fine in Postman. The issue must be something in the Custom Action in intercom.
Does anyone have more details on how to correctly format JSON for intercom?
Hi @Eden !
I had already tried that. Just tried it again, and ran into the same issue.
I’ve also tried having no line breaks using the formatting mentioned in my 2nd post, but again, still running into the issue.
name="Test card from Intercom",project_id=2116,story_type="bug"
This time, Shortcut doesn’t give me a 400 Bad Request, because it seems to recognize the name key as being present, but it gives me a 422 Unprocessable Entity error instead “must specify project id”.
Again, I’m using the same data that succeeds when I test in Postman
Thanks for giving that a try @Doug Taylor. I’ve escalated this as a conversation with the Support team for a support engineer to investigate further with you. They will reach out to you in the conversation as soon as possible!
Resolved!
Even though the request was automatically using Content-Type: application/json (I kept an eye on that in the console), it looks like I needed to actually specify that in the Headers in the Custom Action builder.
Good to keep in mind if you are running into similar issues. Be sure to specify Content-Type: application/json in the headers!
@Eden and Kyle!