Skip to main content
Answered

400 Bad Request error but works fine in Postman


Forum|alt.badge.img

I’m building a custom action that will send a POST request to Shortcut to create a Story.  I’ve tested in Postman and it works fine, but when I use the exact same request body in Intercom, I’m getting a message back that I’m missing a parameter (the missing parameter happens to be the only required parameter).  I can recreate this error in Postman by commenting out (or removing) the parameter in question.  Otherwise, it always succeeds in Postman.

How does Intercom present the body in these requests?  Does it do it exactly as-is, or does Intercom apply some formatting?  Since it works fine in Postman, I’m kinda thinking that Intercom is changing something.

To be more specific, when creating a Story via Shortcut’s API, the only required parameter is “name”.  If my request body in Intercom is this:

{"name": "Just a test card from Intercom"}

I get this message:

400 Bad Request

{"message":"The request included invalid or missing parameters.","errors":{"name":"missing-required-key"}}

 

Works fine if I test it in Postman though. 

Best answer by frencofzc

Make sure there is no error in the configuration of your request. Look for typos, whitespaces, or invalid JSON formatting. To identify the error, use the Postman's console to verify that all the data sent with the request is correct.

E-Commerce Agency In Dubai

View original
Did this topic help you find an answer to your question?

4 replies

  • New Participant
  • 1 reply
  • Answer
  • July 31, 2023

Make sure there is no error in the configuration of your request. Look for typos, whitespaces, or invalid JSON formatting. To identify the error, use the Postman's console to verify that all the data sent with the request is correct.

E-Commerce Agency In Dubai


Forum|alt.badge.img
  • Author
  • Connector
  • 6 replies
  • August 1, 2023

Thanks for the response!

The request works fine in Postman.  It is only when I’m building the Custom Action in Intercom that it fails.  I’ve double-checked for typos, whitespace, and invalid JSON, but found nothing wrong.  

The error message I’m receiving (in the Testing stage of building the Custom Action in Intercom) indicates that Intercom successfully communicated with the destination (Shortcut API in this case), but the JSON lacked the required field (“name”).  In my test, that field was present in the JSON, and formatted correctly.

Here’s a comparison of the Intercom and Postman consoles (Intercom on the left, Postman on the right).  You can ignore the extra parameters in Postman, those were just to better organize the test.  The only required field is “name”.  Tests from Intercom are returning an error that the name field is missing (“name”: “missing-required-key”).  I can’t understand why the name field is recognized when sent from Postman, but is not recognized when sent from Intercom.  Could it be because Intercom is automatically adding the escape and newline characters?  (the \ before quotes, and the \n for newline)?  I have tested removing all whitespace, but Intercom still adds the ‘\' escape character to quotes.  That’s the only difference I can see.

 


 


Forum|alt.badge.img
  • Author
  • Connector
  • 6 replies
  • August 1, 2023

UPDATE:

I just confirmed that the problem IS because Intercom is adding the punctuation and escape characters.  If I reproduce in Postman and try to send the body as

"{\"name\":\"test\"}"

I get the exact same message about the name field missing.

Is there any way to force Intercom to stop modifying the JSON and just send it exactly as I wrote it?


  • New Participant
  • 1 reply
  • September 14, 2023

This is still not solved. I am having the exact same issue as Doug mentioned above. I can reproduce the same in Retool but not in Intercom. So bizarre. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings