Answered

Custom Actions: "Error occurred validating request values"? and no way to troubleshoot

  • 31 March 2023
  • 3 replies
  • 421 views

Trying to set up a Custom Action that, when triggered from a conversation part in Inbox, POSTs the content of that conversation part as JSON along with some other information about the user & conversation to a webhook catch URL (Zapier, in this case):

 

When I’m sending sample data through the Custom Actions UI, this works perfectly every time, the webhook catches the data and I can parse it and go on my merry way.

But as soon as I use the Custom Action on real conversation data in Intercom, I get sporadic errors. The logs say this is because an Error occurred validating request values, but there’s no way to see anything else about what might be causing this:

To make things more confusing, triggering the Custom Action for one message in the conversation is sometimes successful, while triggering the Custom Action for a different message in the same conversation fails! I can only guess that some characters in the message aren’t being escaped and therefore the JSON is not valid.
 

Has anyone else been able to successfully use Intercom attribute values like conversation parts in a Custom Action, or have tips for troubleshooting this error since Intercom doesn’t provide any troubleshooting tips for these errors?

icon

Best answer by Daniel M15 3 April 2023, 18:54

View original

3 replies

Userlevel 2

Hey @Jess Matthews! Daniel from Customer Support Engineering here 🔧 

 

I believe this issue may be related to the fact that you are using “conversation part body”, particularly, for a conversation where said part may not exist. You might find that using “last message body” will give you a similar result, but is more reliable. I see that you are conversing about this in the Messenger with one of my teammates, so I’ll let you take it from there. Could you please share the solution here, once you’ve reached it? 🙏 Thanks!

Hey Jesse, I am getting the same issue, but for tickets. It wont work with any of the contents of the tickets. 

When dealing with sporadic errors in a Custom Action in Intercom, especially when using conversation parts in the payload, it's important to address potential issues with data formatting, encoding, or any special characters that may cause JSON validation errors.

Here are some steps you can take to troubleshoot and potentially resolve the issue:

1. **Data Formatting and Escaping:**
   - Ensure that the data you're sending as JSON in the payload is properly formatted and all special characters are correctly escaped. This is crucial for valid JSON. You may need to escape characters like quotes, backslashes, etc.

2. **Handle Special Characters:**
   - Conversations can contain various special characters. Make sure you are properly encoding and escaping these characters before sending them in the JSON payload. This includes characters like quotes, ampersands, and other reserved characters.

3. **Check for Unicode Characters:**
   - Conversations may include Unicode characters that could cause issues. Ensure that your payload and JSON encoding can handle Unicode characters properly.

4. **Log Detailed Information:**
   - In your Custom Action, log detailed information about the payload, including the specific conversation part causing the issue. This can help you pinpoint the problematic data.

5. **Test with Different Conversation Parts:**
   - If triggering the Custom Action for one message in the conversation is successful while another fails, compare the content of the conversation parts. Identify any patterns or specific types of content that might be causing the issue.

6. **Update Zapier Settings:**
   - If you are using Zapier as the webhook catch URL, ensure that your Zap is configured to handle the dynamic data from Intercom correctly. Check Zapier's task history for more detailed error messages.

7. **Encoding and Decoding:**
   - Confirm that your application and Zapier are consistently using the same character encoding. If there's a discrepancy, it can lead to issues with special characters.

9. **Workaround:**
    - As a workaround, you might consider modifying your workflow to sanitize or preprocess the data before sending it to the webhook. For instance, you could clean up or replace problematic characters.

If the issue persists and you are unable to pinpoint the cause, involving Intercom support and potentially Zapier support can provide more tailored assistance based on the specifics of your integration and data.

Reply