Use the Zapier automation tool and Telnyx SMS to forward your messages for marketing purposes.
In this tutorial, we’ll walk through the steps on how to forward SMS to Slack, email, and another phone number using the Zapier automation tool and the Telnyx CPaaS platform.
This can be useful for when you are sending out communications that you want to distribute across multiple channels, or to different parties. Before starting the tutorial, make sure to follow the Telnyx SMS Quickstart Portal Setup Guide
to complete the following prerequisites:
- Create a free Telnyx portal account
- Buy an SMS capable phone number
- Create a messaging profile
- Associate your SMS number with this messaging profile
- Obtain your API V2 authorization key and V2 Profile ID
Inbound SMS to Messaging Profile Trigger
Follow the steps below to create your new Zap with Zapier. This will set up a trigger for inbound SMS to one of your Telnyx messaging profiles.
- Sign up for an account at Zapier.com if you don’t already have one
- Select the “Telnyx” app
- Select the “Receive a Message” event
- Click “Continue”
- Click on the “Choose an account” dropdown
- Select “Connect a new account”
- Enter your “v2 API Key” and “v2 profile ID”
- Click “Yes, Continue”
Now any inbound SMS to any of the numbers associated with this messaging profile will trigger this Zap to run.
Forward SMS to Slack
Using this Zap, you can set up a Slack action to forward the SMS to the intended destination. For example, you can forward the inbound SMS to a direct message or a message in a channel.
I would recommend choosing “Yes” for the “Include A Link To This Zap?” option so that if there is an issue it is easy to follow the link from the Slack message and start troubleshooting.
Forward SMS to Another Number
You can forward the SMS contents to another phone number using the “Send SMS” action in the Telnyx app or using Python code in a “Code by Zapier” action to make a request to the Telnyx SMS API.
Using Python code to make the request will allow you to factor in more complex logic and conditions before sending the message. For example, you can set up logic to only forward the SMS if a keyword is present in the inbound text.
If you want an example of how to send an SMS with Telnyx using Python code in a “Code by Zapier” action take a look at the Send Response using Telnyx SMS API
section in the “Marketo 2 Way SMS using Telnyx and Zapier” post on the Workflow Pro blog.
Forward SMS to Email
The “Email by Zapier” action can be used to forward the SMS contents to an email address. Again, it is recommended to include a link to the history of this Zap so that it is easy to click the link and start debugging, if necessary.
Forward SMS to Slack, Email, & URL using Webhooks
If you have a system in place that can send information about inbound SMS using webhooks then you can use the “Catch Hook” trigger event in the “Webhooks by Zapier” app. The “Custom Webhook URL” field will provide you with a destination URL that you can send the inbound SMS information to.
Forward SMS to Slack, Email, and URL using webhooks in Zapier
"Catch Hook" trigger event in Zapier
“Custom Webhook URL” of the “Catch Hook” trigger event
For example, on any Telnyx messaging profile you can forward any inbound SMS using webhooks to a primary URL or a backup URL if sending to the first URL fails.
Telnyx messaging profile webhook forwarding URLs
If you are looking for a way to test this “Catch Hook” trigger then you can use Postman, the free API testing tool, to make a POST request to the “Custom Webhook URL”. Take a look at the Testing the Marketo API using Postman
in the “Marketo API Quick Start Guide” post on the Workflow Pro blog to learn how to make your first POST request.
Postman POST request to Zapier custom webhook URL
Once you have triggered the zap then the exact same “Forward SMS to Slack” and “Forward SMS to Email” actions from above can be used to forward the SMS to Slack and email respectively.
Forward SMS to URL
You can also forward any inbound SMS information to a destination URL using the “POST” action event of the “Webhooks by Zapier” app. In the “Set up action” section you can populate the body of the webhook and specify any headers and authorization that you need to make a request to the destination URL.
Forward SMS to URL using a Zapier webhook
A great site for testing your outbound webhooks is https://webhook.site/
because it gives you a URL to send information to, which it will then display as webhooks come in.
This topic was modified 8 months ago by shane