Twilio is a popular provider of messaging solutions, and in the context of Uncanny Automator, it means you can send SMS notifications directly in your recipes. You don’t have to route messages through a third party, you don’t need extra plugins, adding Twilio means you can send text messages to users and admins for almost any WordPress interaction.
Before starting
Here’s what you need before we dive into the tutorial:
- Uncanny Automator Pro.
- A paid twilio plan.
How to set up a Twilio integration
Connecting to twilio requires setting up a phone number and API key in your twilio account. If you are using a trial version of twilio, a trial phone number is fine.
1. After signing in to your twilio account, visit the twilio dashboard.
2. If you don’t yet have a number in twilio from which to send SMS messages, click Get a Trial Number. You can also purchase a number. Make sure the number you generate supports sending SMS messages. Once you have a number for sending text messages, make a note of what it is.
3. Open the twilio dashboard again and look for the Account SID and Auth Token fields. You will likely have to show the Auth Token.
4. Return to Automator > Settings and the Twilio tab inside your WordPress site as an admin.
5. Paste the Account SID, Auth Token and Twilio number from the twilio console into WordPress.
6. Click Save API details.
Sending SMS messages with Automator
Once twilio details have been entered and saved, Automator recipes will have a new twilio action available to send SMS messages. To send messages to a number, choose the action, enter phone numbers in the To field and enter a message Body. Multiple numbers can be separated by commas.
Remember that tokens can be included in the To field, so if the SMS message will be sent after a purchase, you can look up the user’s phone number (if it’s entered on the checkout page) by expanding the tokens under the trigger listing and choosing Billing phone.
If your triggers do not include ecommerce transactions, you can still look up user phone numbers if you know the User meta key that’s used. (Because WordPress doesn’t normally capture a phone number, we can’t make a default token available for phone number as it will vary depending on what plugin you use to capture it.)