Table of Contents
Note: This document has been imported from the former KB and has not yet been verified.
Welcome to BYO Twilio! Here, you will be able to fine-tune your SMS needs with multiple outbound and inbound phone numbers, and automate your SMS with Twilio Studio Flows.
This BYO Twilio integration:
- Gives you control over how inbound SMS is handled
- Allows you to configure multiple inbound and outbound phone numbers
- Allows you to setup custom autoresponders for when a customer sends in an SMS
- Integrates with Twilio Studio Flows to automate your needs
- Supports MMS
Note: You can use more than one SMS integration (e.g., Flowroute and Twilio). However, outbound SMS will use the first integration you have enabled in this list:
- BYO Twilio
- Flowroute
- Syncro's Default SMS provider (Twilio)
So, if you are using BYO Twilio, this will be your outbound SMS integration, regardless if you have another integration enabled. Inbound SMS will still work as expected, even if you use all of the above.
Prerequisites
You must already have your own Twilio account.
Getting Started
Enable the Twilio Integration
Navigate to Admin > App Center, then click the Twilio App card:
Once here, you will see that this integration will require two fields (Twilio Account SID and Twilio Auth Token). You can locate these two fields inside your Twilio account. Navigate to Twilio (https://www.twilio.com/), and click “Log in.” Sign into Twilio using your Twilio credentials.
Once you log in, you should be taken to the Twilio Console (https://www.twilio.com/console). This is where you will find your "Account SID" and "Auth Token". Copy/paste these fields from Twilio into Syncro, respectively.
After entering in these two fields, click "Save" to officially enable the integration.
You will notice that there is a "Required Security Token" that you can configure. You may choose your token, or we will set one for you.
Next, we will need to setup your Twilio phone numbers.
Configure Your Twilio Phone Numbers
Once you have the integration enabled, you will want to setup your Twilio Phone Numbers. You have a few areas of the app to configure:
-
Main Shop - Default Number: This is required.
- This phone number should be your main inbound Twilio Number.
- Use the Twilio phone number you want your customers to SMS.
- It is not recommended to use this number for Twilio Studio Flows (more on that here).
- If you have one Twilio Phone number, set that number here, and leave the rest of the options as “Default.”
- Ticket Updates: This number is used for outbound SMS for ticket comments, and for ticket automation.
- Appointment Confirmations: This number is used for outbound SMS for Appointment Reminder Schedules
- Notification Center: This number is used for outbound SMS for Notifications from the Notification Center
- Marketing Center: This number is used for outbound SMS for Mailer
To finish setup on your "Main Shop - Default Number", copy the red callback URL found on the Twilio App page in Syncro. It should look something like this:
https://YOUR_SUBDOMAIN.syncromsp.com/api/v1/twilio/process_sms?token=YOUR_TOKEN
Now go back to Twilio, and head to the Twilio Console/Dashboard. Click on the circle with three dots in the middle to open the "All Products & Services" sidebar.
Next, select "Phone Numbers" under "SUPER NETWORK" to view all your Twilio Phone numbers. You should see a list of numbers like this:
(If you do not see any numbers, you will need to buy some! More information here)
Once here, select the number you set as the "Main Shop - Default Number", and scroll to the bottom of the page. You will need to update the "Messaging" section with the callback URL you copied earlier.
Be certain to set it to use a "Webhook" and an "HTTP POST", just like in the screenshot above. Then, click Save.
Set Up Inbound Rules
Inbound rules allow you to configure how to handle inbound SMS sent into Syncro. Here are your options:
- No matching Customer or Contact: Triggers when the inbound SMS number does not match a customer or a contact in your account.
- No Open Ticket: Triggers when the inbound SMS number matches a customer or contact in your account, and the customer/contact does not have any open tickets.
- One Open Ticket: Triggers when the inbound SMS number matches a customer or contact in your account, and the customer/contact has exactly one ticket open.
- Multiple Open Tickets: Triggers when the inbound SMS number matches a customer or contact in your account, and the customer/contact has more than one ticket open. Comment on a ticket will try to choose the ticket that currently has the most recent outbound ticket comment.
Control Autoresponders
These autoresponders correlate directly with the inbound rules. If an inbound SMS matches an inbound rule, and the corresponding autoresponder is not blank, it will automatically respond to the inbound SMS with the autoresponder text.
Notes:
- If the autoresponder is blank, it will not send a message.
- SMS template tags are supported (i.e. {{customer_first_name}}).
Advanced Use
Enable Twilio Studio Flows
To enable Twilio Studio Flows, navigate to Admin > App Center and select the Twilio app card.
Next, you will need to accept the disclaimer, confirming that you understand that this feature is very technical in nature, and is not for everyone. Syncro's Technical Support will not be able to assist you in configuring this feature, and you may need to hire a developer to help you get it right.
Additionally, we recommend reading over Twilio's documentation on Studio Flows.
Nevertheless, we will get you started on using the feature here.
Once you enable Twilio Studio Flows, you will unlock Twilio Studio Flows throughout the app.
Use Twilio Studio Flows
Here is the basic overview on the integration:
- Your account will send a JSON payload with basic information about the resource you are sending over. For example, appointment confirmations will send over the appointment time/date.
- You can add additional fields to the JSON payload as you see fit. So if we didn't include the information you need by default, you can include it.
- This data can also support template tags (wherever possible).
Enabling Twilio Studio Flows will unlock additional options throughout the app.
On each of these, you will notice you can add your own custom data. Syncro will also send some data in the JSON payload by default to help. For example, here is what Appointment Reminders sends over:
To access this data in a Twilio Studio flow in a flow, you will need to use the {{flow.data}} tag. For example, if you wanted to access the customer name field above, you would use the tag {{flow.data.customer.name}}.
To access custom fields, you would still use the {{flow.data}} tag. For example, to access the value "example data" stored under "example", you would use {{flow.data.example}}.
Read more about using variables in Twilio Studio Flow.
Appointment Confirmations
Appointment Reminders now have the option to trigger a Twilio Studio Flow! You can trigger a flow X hours before an appointment, along with the morning of/night before:
Additionally, we added an API endpoint to trigger to update an appointment about whether an appointment was confirmed by a customer.
The endpoint is /api/v1/twilio/appointment_confirmation
Required Parameters:
- token: This is the Required Security Token found on the BYO Twilio app page
-
appointment_id: This is the appointment's ID you want to update.
- Can be accessed through {{flow.data.appointment.id}} on this appointment reminder trigger.
-
appointment_action:
- confirm - Updates a linked ticket that the appointment was confirmed via private ticket comment.
- cancel - Updates a linked ticket that the appointment was cancelled via private ticket comment.
Notification Center
Here, you can setup Twilio Studio Flows to trigger when a notification is triggered. You can setup one Twilio Studio Flow per notification set, but you can trigger it with as many events as you would like.
Mailer
With Mailer, you can SMS and/or trigger a Twilio Studio Flow to follow-up with your customers. You no longer are restricted to just E-mails.
Ticket Automation
With Twilio Studio Flows enabled, you will get the option to trigger a Studio Flow as a ticket automation action. Without Twilio Studio Flows enabled, you will still get the option to SMS the customer/contact, or send a manual SMS. Template tags are also supported here.
Automated Remediation
Much like Ticket Automation, Automated Remediation receives a new action to trigger a Twilio Studio Flow as well! It also receives the option to SMS the customer/contact, or to send a manual SMS without enabling Twilio Studio Flows.
Twilio Studio Flow and Twilio Function Examples
We're including some Twilio Studio Flow templates, and Twilio Functions you can add to your Twilio account! Feel free to add/edit them to best fit your needs.
For the Twilio Studio Flow templates, there will be fields you will need to update. We have prefaced these fields with 'replace-me' to help make them easy to find an update. For example, 'replace-me-subdomain' means to delete 'replace-me-subdomain' and replace it with your Syncro account's subdomain.
Learn more about how to import these JSON flows into your Twilio account.
Simple Appointment Reminder - Studio Flow
This studio flow is a great one to try first. Hook it up to an appointment reminder schedule setup to alert 1 hour before an appointment will start, and it will SMS the customer a heads up that the assigned Tech will be there soon. As a bonus, it also sends a picture of the tech found on their users page so the customer knows who it is!
Here's an example from Jon Snow the technician:
This studio flow is simple; just copy and paste it from here, and you are good to go!
Appointment Reminders Confirmation - Studio Flow
This studio flow is great to use if you would like your customer to confirm or deny an appointment reminder. It will SMS the customer and greet them by name, and give them a reminder about when their appointment is scheduled. The customer can respond with a 'C' to confirm the appointment, or 'X' to cancel the appointment. If the appointment has a ticket attached, then their response will update the attached ticket with a private ticket comment on whether they confirmed or cancelled the appointment.
You can find it HERE.
Log Inbound Call - Studio Flow
This studio flow will take an inbound call, searches for a customer in your account with the same phone number, logs the call under the "Communications" tab on the customer's page, pops up a message at the bottom of your screen that indicates a call is inbound, and finally forwards the call to a number you specify.
Please note that this studio flow uses the PBX security token as a parameter in order to work. You can find this token under the FreePBX app in the app center. Learn more about the PBX integration.
You can find this studio flow HERE.
Tech Hunt - Function
Want to call your techs until one answers the phone? Try this.
Play a song over a call - Function
Pretty neat example of how to greet your customers.
Other Functions
There is a whole repo of ideas here. Try them out!
Troubleshooting
If your Studio Flow isn't working, try these troubleshooting tips:
- Navigate to the Studio Dashboard in Twilio, to see logs for each of your flows. This should give you helpful information on whether the issue is on your side, or on the Twilio side. In the logs, you can see the flow data sent over to Twilio. Check this out to see what the JSON flow data is, and how you can access it.
- Make sure your web requests to your Syncro account has your Required Security Token. Without this token, the request will fail.
- Twilio has a debugger, check it out for fails! Twilio will also email you when there is a failure on any of your flows by default.
- There can only be one active execution running at a time for a phone number (per flow). You will want to check your Twilio Studio Flow Executions under the Logs for that Flow to see more.