Do you dream of a two way SMS - Email integration to be able to send and receive SMS from your email address? We've got good news. With our handy Zapier integration and some Zapier Foo you can have that working in no time. This guide will help you set that up.
Guide to 2-Way SMS and Email Integration with Telnyx
You are going to need to use two Zaps for this to work, the first one will forward your inbound SMS to your email address and the second one will forward your emails to your intended SMS recipient. Since we do need to use advanced Zapier features this would only work if you have a premium subscription to Zapier.
The trick here is to use the subject line exclusively for the number you sent you the SMS or the number you want to send the SMS to. Since Zapier can use the subject as a variable we don't have to do something overly complicated to be able to tell Zapier where to send the SMS to.
We are going to take advantage of Zapier's granular configuration capabilities to set the reply to variable in the first Zap as the email from the second Zap to be able to comfortably just hit reply to any email we receive from Zapier and get that sent as a text. But in order for that to work you have to either remove the RE: from the subject line manually or use a Zapier premium feature called Formatter to be able to extract the number and pass that on to the next step. Trying to send the subject variable with the Re: tag that gets added to any replied email will result in an invalid number. We'll go into the details of this later on with nice screenshots for you to follow.
A WARNING before we proceed. When sending an email to be forwarded as an SMS do consider that there is up to 160 character limit on SMS and if your body includes more characters it will be separated into several SMS. The cost for sending SMS is per each SMS or per part so if you send a big email it can multiply the cost depending on how many parts where used. Make sure you clear all the text from your emails when forwarding or replying so that only the main text you want to actually send is sent.
Step by Step Guide to Setting Up Two Way SMS
1. First create a new Zap and choose the Telnyx Zapier integration for your Trigger. Select Receive a Message for the trigger.
2. Now make sure you supply your v2 API Key (you can generate one in the Auth section of your Mission Control Portal account) as well as the ID for your Messaging Profile (you can find that in the Messaging Profile settings page). You also need to already have a number with us and have that number associated with the Messaging Profile you have supplied for this part.
3. Before you proceed send a sample text message to your Telnyx number so that Zapier gets a good idea of what variables it will be dealing with and click on continue to proceed to the next step.
4. Now for the next part we are going to use the Email by Zapier integration.
4. Now lets customize the outbound email details.
To: Your email address needs to go here.
Subject: Select the From Phone Number variable from the Trigger.
Body: Select the Text variable from the Trigger
You don't need to modify anything else for the meantime.
You can skip the test and activate the Zap, we'll try it out in a bit.
5. In order to properly test the whole Zap, once it's turned on, send a test SMS to your Telnyx number.
You should get an email like this:
Congratulations! You've got the first part working! No we need to setup the second part so you can reply back from your email.
6. Setup a new Zap and this time we need Email by Zapier as the trigger.
7. Here Zapier will create a random email address to which you can add the first word before a random set of characters make sure you save that email address, we need to configure that as the reply-to email address from the previous zap to make things easier for you.
8. Now for the action part of the Zap look for the Telnyx Zapier Integration. It will let you choose the Telnyx Account and Messaging profile you had previously configured.
9. Now choose the Send SMS option.
10. Now Customize the SMS.
Source Number: This needs to be the Telnyx number you have assigned to your Messaging Profile.
Destination Number: Here you need to choose the Subject variable from the trigger event.
Message Content: Here choose the Body Plain variable from the previous part.
Save everything, skip the tests. The Subject variable won't likely be a valid number unless you have sent an email with a number in the subject before so any test with the sample data will fail, this is normal.
11. Now go back to the previous zap and edit the action trigger (the second part of the zap where it sends an email). And now add the email address you got from the second Zap to the Reply To field in this first zap.
You should now be able to receive SMS to your Telnyx number and those will get forwarded to your email. You can also send emails to the specified email address from your second Zap with a number in the subject line and those will get forwarded to the number you've specified. Remember you need to specify a number in +E.164 format so for any US number you need to add +1.
The issue now is that if you hit reply to any email you receive from Zapier although the email from your second Zap will auto populate as the reply to address, the subject is modified by your email program adding a Re: before the number. This will result in an invalid number and the SMS won't be sent. In order to fix this, you can simply remember to remove that from the subject line before you send the reply or use one of Zapier's extra feature, the Formatter.
If you've chosen the path to convenience and like everything fully automated then this will help you setup the last part.
This is the error you would see if you don't use the formatter and you don't manually remove the Re: from the subject.
To fix that go into your second Zap and click on the plus sign in between your trigger and your action. You'll be able to choose different option, you want to use Zapiers Formatter
Now Zapier has precise extraction in the Formatter for numbers but that is used to make algebraic operations and stuff that we won't really use. What you need is text so make sure you select the text option.
Now in the Customize Text section you need to choose Extract Number. Zapier has a Extract phone number option but since they think phone numbers are only 10 digits long this won't work.
If you check the send Data you'll see that the number including the plus sign is extracted and sent as output.
Now you need to modify the action part of the Zap to make sure it uses this new modified variable instead of the old Subject field.
In the Customize SMS section of the Action click on the Destination Number
And make sure you select the Subject variable from the Formatter Text option.
You're all set. Now you should be able to send and receive SMS to and from your email while conveniently hitting the reply button to reply to the SMS you receive.