Error Parsing JSON from Intercom after receiving response

Hi, how are you? I wanted to start a conversation because I am having a problem receiving response information from a webhook within Intercom, my support platform.

This is the workfloow I am using. In the last block you can see that I am calling a value that was filtered in the previous block. The response is configured to send within {"statusIS":} the corresponding value. This is configured based on the path to capture the filtered value.
Up to this point everything is perfect since the response takes the value it should take from the previous block.

I found the problem when capturing the data from intercom. Here I am faced with the JSON parsing error.

{
"error": true,
"messsage": "there was a problem parsing the JSON body of webhookReturn1"
}

From here I decide to change the value of the response to a "plain" text. Everything works correctly and the intercom receives the information perfectly.



From what I see, Intercom cannot read the path that is sent to it.
Is there a way to solve this problem and have the response value be sent in plain text?
Is there an alternative to creating a conditional that executes one workflow or another?

I also tried by creatin a branch with a conditional by setting 2 different responses but it didnt work.

{
"workflowError": "Your workflow failed during execution."
}

ON POSTMAN EVERYTHING WORKED WELL

What are the workflow logs showing?

Is it possible the userId being sent in is resulting in no results from the DB, in which case query1.data[0].status would throw an error? If so, and probably even if you think not so, you can set it up so that if the userId is not found in the DB the workflow fails gracefully by adding the final else branch to return "user not found" when query1.data?[0].status == undefined (add the "optional chaining" ? to every step in the branch as well, otherwise those branches will fail).

Hi, thanks for the answer. Im sure the id is on the DB. The flow works perfect on postman and returns the expected value. The problem is when intercom tries to capture the response.

Are you able to see the raw data that Intercom is receiving? Since it seems that it works fine in Retool and in Postman, something is going on there.

1 Like

Thats the problem. Whenever i try to send the raw data with the path of the value im trying to send it shows this error up. But when i send plain text i can see the raw data from intercom

You can see that whenever i send {"statusIS": "verified"} (where verified is plain text) Intercom recieve the data perfectly. The problem is whenever i try to send it as {"statusIS": wuery1.data[0].status} to intercom. When i send it, intercom says that there was an error parsing the JSON, but postman read it well and recieve the data as {"statusIS": "verified"}

Shot in the dark, but maybe {"statusIS": String(wuery1.data[0].status)} because for some reason it is coming as a different type (at least according to Intercom)?

no :frowning:

Hi @mateovallejo :wave:

Sorry you're running into issues here. Could you send screenshots of the postman request? Since the plain text approach was working, I'm curious if using a JS transformer between query1 and webhookReturn1 to format the return body would fix the error.