Achieving a full 2-way integration for SMS is a major obstacle for every contact center.
The use case:
- An agent sends out an SMS to a customer and a ticket is opened
- The customer replies and the same ticket is updated as was created by the agent
What babelforce does: babelforce is using the Zendesk API to find a ticket based on a predefined definition, e.g. a ticket is not solved, yet has a specific tag (e.g. SMS), and has a reference to the sender. If the ticket exists, we update the ticket. If it doesn't exist, a new ticket for the SMS is created.
Warning: The Zendesk search API is slow. As babelforce is doing a lookup using the Zendesk API, it might happen that newly created or updated tickets do not appear or appear wrongly in the Zendesk result and therefore freshly created or updated tickets are ignored.
The integration has two parts:
- Sending SMS
- Receiving SMS
The automations you build for each part are very similar but have some important differences that we will point out for you.
This article is separated into four sections - follow each of the steps and you will achieve your full integration:
- Adding a customer babelforce event integration
- Adding two custom events
- Creating the Automations for sending SMS
- Creating the Automation for receiving SMS
Adding a customer babelforce event integration
First of all, go to Integrated processes > Integrations and add a new integration: babelforce Events. You don't need any further credentials but it will be needed for the Custom Event we will dispatch. Just select a nice name and a color you like.
Creating two custom events
Next, find the section Custom Events. Go to Integrated processes > Custom events. Just add two new custom events that fancy, in our case we added:
These Custom Events by themselves are empty containers. We will use them in our Global Automations as you will see.
Sending SMS
For sending and receiving SMS we will be building 5 Global Automations, each. Below is the list for your sending Automations:
Let's start at the beginning:
1a) Look up end user
Create a look-up end user Zendesk_V2 action on the Event SMS sent that always fires (ensure you have an Always trigger set up in your account):
2a) Create a custom search
This one is a bit more tricky and you also need to adjust it to your own Zendesk. Below we give you one example on how you can achieve this. First of all, find out which tickets you actually want to update. In our case, we decided for the following use case:
- Any ticket that is new, open or pending should be searched for
- that has a tag SMS
- and which includes the customer's From number in the description
To find out which search options are available in Zendesk, we recommend this article.
https://support.zendesk.com/hc/en-us/articles/203663226-Zendesk-Support-search-reference
We also recommend just testing your search queries in your own Zendesk and to see whether or not you're getting the tickets you are looking for. What babelforce does in this search: We use the exact same endpoint as the Zendesk search query and return the same results you see in your own Zendesk.
We then save relevant information in variables that you can use in your upcoming Automations.
Two things you need to keep in mind:
- define which fields you need returned (id would be necessary as you need the ticket id to later update this ticket
- and define a variable in which your result is going to be stored.
once this lookup runs and successfully returns a result, ticket id and ticket subject would be accessible via these two variables and can be reused in Automations and Triggers:
- integration.zendesk_v2.ticket_search.id
- integration.zendesk_v2.ticket_search.subject
As you can see the logic is as follows:
- integration.zendesk_v2.{store_as_variable}.{returned_variable}
3a) Dispatch the custom event
Next, also on SMS sent, find the babelforce action "Dispatch custom event". Copy past the event name you created for sent SMS, in our case it is called "Sent SMS".
4a) Create a Trigger and a Create Ticket Automation
Below you find a GIF that explains how you can create a trigger from within the Global Automation.
A few things to keep in mind:
- As we are entering a variable as condition that is not known to babelforce, you need to switch to "Expert mode"
- To test whether or not the Custom search returned a ticket ID, enter your variable in the Expression field, in our case it is: integration.zendesk_v2.ticket_search.id (make sure to have no spaces or {} added)
- You expect that the variable is given.
- Next, it is very important that you INVERT the trigger as we only want to create a new ticket if the search result does NOT return anything
- Now we need to make sure to select the right Event: you Dispatched a Custom Event (we created Sent SMS) - the two other events following, create ticket or update ticket, will both run in this custom container. The screenshot below shows how you find them in the Action field:
- Add the customer id we looked up at the very beginning of the flow: {integration.zendesk_v2.enduser.id}
- To assign the the ticket to the agent who sent the SMS, add this variable: {agent.sourceId}
- The ticket create Automation could look like this:
- As you can see, we are adding the tag sms to be able to find this ticket in case the customer writes back (see search filter 2a)
- Also, we are adding a description containing the customer's number which is also relevant for our custom search filter.
- Of course you can also set any status that is relevant to your internal processes.
5a) Update Ticket Automation
Now only one Automation is missing: in case we send a message but there is already a pending or open ticket we want to attach the agent's reply to this ticket.
The easiest way to achieve this is by copying the Create Ticket Automation and do a few adjustments:
- change the title
- adjust the Action to "Update ticket"
- ensure that the trigger is NOT converted
- most importantly, you need to add the variable for the ticket ID that was found by the custom search, otherwise, babelforce does not know which ticket to update
How the tickets itself is setup is up to you, find an example below:
That completes the setup of the integration for sending SMS.
The next part looks at the Automations for received SMS - they are almost the same, just a few differences apply which we will point you to.
Receiving SMS
Just as for the first part, you need to create five Global Automations. We suggest you simply copy the first five Automations and edit them accordingly. Every copied Automation will, by default, be disabled. Ensure to activate them before starting to test.
This is the overview of the five Automations we built:
1b) look up enduser
Copy the Look up end-user event. The only thing you need to adjust is the Event (needs to be SMS received)
2b) Create a custom search
Also the custom search is ALMOST the same. The most important difference, besides the Event, is the search filter: it needs to say {sms.from}!
3b) Dispatch the custom event
Also the Dispatch custom event needs two adjustments
- Change the Event
- Change the name of the custom event
4b) Create Ticket Automation
- The one is almost the same - however, you need to watch out and change the Event name to your custom event for receiving SMS! Otherwise this action won't run.
- Also, it makes sense to adjust the Comment text to clearly show that the SMS was sent by a customer.
- It is likely that you want to receive a "new" ticket, so don't select a ticket status.
5b) Update Ticket Automation
And finally, the update automation. There is not much to adjust here:
- Event
- Very likely, you want to adjust the comment field
- Change the status to Open if this matches your internal procecss
This completes this rather extensive article. However, it should help you to build a fully integrated SMS communication. Please let us know if you have any open questions.