Issue
When integrating Twilio Studio with Slack, some users may encounter an issue where certain messages are not delivered to the Slack channel, even though test messages are received successfully. This article explains the cause and provides a step-by-step solution.
- Test messages sent through the Twilio Studio flow are delivered to Slack as expected.
- Some notification messages are not appearing in the Slack channel.
- No explicit error messages are shown in Twilio Studio or Slack.
Cause
Sometimes messages often contain extra characters or formatting (such as periods, special symbols, or additional text) that can break the JSON structure required by Slack’s API. This can prevent the message from being forwarded correctly.
Resolution
To resolve this, you can modify your Twilio Studio flow to strip out the extra characters from the message body before sending it to Slack. This is done by updating the HTTP Request Body in your Studio flow using Twilio’s Liquid template language.
-
Open your Twilio Studio Flow
- Navigate to the flow that handles incoming messages and forwards them to Slack.
-
Locate the HTTP Widget
- Find the HTTP widget responsible for sending messages to Slack.
-
Modify the Request Body
- In the Request Body, update the message content as follows:
{"text": "+[YourNumber] {{trigger.message.Body | split: '.' | first}}"}- Replace
[YourNumber]with your actual number or desired prefix. - The key part is
trigger.message.Body | split: '.' | first, which splits the message at the first period and takes only the first part (usually the main message).
-
Save and Publish the Flow
- Save your changes and publish the updated flow.
-
Test the Integration
- Send a test message to your Twilio number and verify that it now appears in your Slack channel.
Example
Original Message:
This is a test message. @Don't share it with anyone. @abc.com #123456 %abc.com
After Applying the Solution:
Only the first part (This is a test message) will be forwarded to Slack, preventing JSON errors.
Additional Information
If you continue to experience issues after making this change, check your Studio flow execution logs for errors. You may also want to provide the Flow Execution SID(FNXXXXXXXXXX) to support for further troubleshooting.