SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Messages not Forwarding to Slack via Twilio Studio

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.

  1. Open your Twilio Studio Flow
    • Navigate to the flow that handles incoming messages and forwards them to Slack.
  2. Locate the HTTP Widget
    • Find the HTTP widget responsible for sending messages to Slack.
  3. 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).
  1. Save and Publish the Flow
    • Save your changes and publish the updated flow.
  2. 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.

Have more questions? Submit a request
Powered by Zendesk