Twilio - Bring Your Own
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.
What it does
- Gives you control over how inbound SMS is handled
- Allows you to configure multiple inbound and outbound phone numbers
- Allows you to set up custom autoresponders for when a customer sends in an SMS
- Integrates with Twilio Studio Flows to automate your needs
- Supports MMS
What it does not do
- Provide you with a Twilio account
- Hire a developer to build awesome Twilio Studio Flows for you
- Find your lost car keys
Table of Contents
Getting Started
- Enabling Twilio
- Configuring your Twilio Phone Numbers
- Setting up Inbound Rules
- Controlling Autoresponders
Advanced Usage
Troubleshooting
FAQ
Getting Started
1) Enabling the Twilio Integration
First, head to the App Center (Admin > App Center), and find the Twilio App. Click on it to configure Twilio.
Once here, you will see that this integration will require two fields (Twilio Account ID and Twilio Auth Token). You can locate these two fields inside your Twilio account. Head 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 RepairShopr, respectively.
After entering in these two fields, click "Save", and you have officially enabled 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.
2) Configuring 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:
Notes on each:
- 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 Marketr
To finish setup on your "Main Shop - Default Number", copy the red callback URL found on the Twilio App page in RepairShopr. It should look something like this:
https://YOUR_SUBDOMAIN.repairshopr.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, and you should be all set!
3) Setting up Inbound Rules
Inbound rules allow you to configure how to handle inbound SMS sent into RepairShopr. Here are your options:
Notes:
- 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
4) Controlling 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.
Important Notes:
- If the autoresponder is blank, it will not send a message
- SMS template tags are supported (i.e. {{customer_first_name}})
Advanced Usage
5) Enabling Twilio Studio Flows
To enable Twilio Studio Flows, head to the Twilio App in RepairShopr (Admin > App Center > Twilio). 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. Our 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 HERE.
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!
6) Using 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. We'll cover each section in detail:
On each of these, you will notice you can add your own custom data. RepairShopr 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}}
.
You can read more about using variables in Twilio Studio Flow HERE.
6.1) 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
- You have two options for this:
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.
- You have two options for this:
6.2) 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.
6.3) Marketr
With Marketr, 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!
6.4) 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.
6.5) 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.
7) 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 RepairShopr account's subdomain.
Also, you can learn more about how to import these JSON flows into your Twilio account HERE.
7.1) 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!
7.2) 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.
7.3) 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. You can also learn more about the PBX integration here.
You can find it HERE.
7.4) Tech Hunt - Function
Want to call your techs until one answers the phone? Try this: https://github.com/twilio-labs/function-templates/tree/master/hunt
7.5) Play a song over a call - Function
Pretty neat example of how to greet your customers: https://github.com/twilio-labs/function-templates/tree/master/never-gonna-give-you-up
7.6) Other Functions
There is a whole repo of ideas here. Try them out! https://github.com/twilio-labs/function-templates
Troubleshooting
1) My Studio Flow is not working! Any tips?
- If you head to the Studio Dashboard in Twilio, you can 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 RepairShopr 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.
FAQ
Q: Can I use more than one SMS integration (e.g. Flowroute, Clickatell)?
A: Yes, you can! However, outbound SMS will use the first integration you have enabled in this list:
- BYO Twilio
- Flowroute
- Clickatell
- RepairShopr's Default SMS provider (Twilio)
So, if you are using BYO Twlio, 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.