Connecting Inbox to Zendesk using Flow Builder
Last updated
Last updated
In this guide, you’ll learn how to integrate Inbox with Zendesk with Flow Builder.
You can integrate Inbox with 3rd party systems by adding additional steps in the Inbox Flow Builder flow. In this guide, we’ll illustrate a simple contact synchronization scenario:
Show Zendesk contact information directly in Inbox—so that your agents know who they are interacting with.
Ensure that if an agent further enriches the contact information (e.g. gets better customer details) that new contact information is synchronized back to Zendesk.
Prerequisites
A Zendesk account
Knowledge of the Zendesk API
An Inbox account
Pro-tip: In this guide, samples are provided to navigate the more technical aspects. Be sure to import the provided flow for details.
What it will look like
Sometimes it’s easier to understand how to get there if you can already see where you’re going, so here is the final flow we will build:
What we will be doing
Customize the default Flow Builder Inbox flow (which is created by default for every Inbox installation)
When a user conversation is initiated in Inbox, we’ll query Zendesk for any data available about that contact
Update the Inbox contact with the information retrieved from Zendesk
After the interaction is concluded (ticket closed), the contact information (potentially updated) is automatically push back to Zendesk
End result as importable json
You can import this flow directly into your sandbox. You’ll have to connect it to the appropriate channels.
If you already have an Inbox Flow (Conversations) flow, deselect the channels from the first step, Omnichannel and you’ll be able to select them in the flow you just imported.
Step by step
Step 1: Locate the flow corresponding to your Inbox installation
1. Go to Flow Builder and choose the Inbox Flow (Conversations) flow.
By default, this flow has one step, Create Inbox ticket:
Step 2: Determine the channel
To best locate the corresponding contact inside Zendesk, we’ll determine the channel the customer is reaching out on (phone, email, etc).
1. Add a Branch step to the flow and check if there’s a phone number associated with the contact (meaning that the conversation is happening over a channel that has a phone number as an ID, like SMS or WhatsApp).
2. To set the condition of the branch, choose custom condition and check if the contact’s phone number is set:
Step 3: Query Zendesk for contact information
If it’s a conversation coming over on a phone number (as opposed to conversations over emails or live chat), then we can query Zendesk using their Search API to see who is associated with that particular phone number:
1. Look for contacts that correspond to that particular phone number, using something like:
2. Convert this to a Flow Builder HttpFetch request. The query parameters will reside in the URL, and we’ll make sure to URL encode the query parameter:
https://{subdomain}.zendesk.com/api/v2/search.json?query=type%3Auser+phone%3Acontact.phoneNumber
3. Since the Zendesk API requires user and password authorization, we need to convert that to something Flow Builder understands, meaning an Authorization header with Basic authorization.
4. As a preliminary step, we will need to Base64 encode the user:password parameter. Using https://codebeautify.org/base64-encode. It will look something like this:
5. Putting it together, it becomes an Authorization header:
6. Done? Awesome! Now we need to store the results we received inside a variable.
Since in Zendesk you can have multiple contacts with the same phone number, we must make a decision and choose which is the “best”match”. In this example we will simplify things and just pick the first result (results[0]). We will be picking up the phone, email, name, and URL for the Zendesk user.
Note: We will need the Zendesk user’s URL later to push back changes to Zendesk.
Pro-tip: Do a CURL query to the Zendesk API to check the entire response and understand what other properties might be extracted.
Step 4: Check if we got at least one match
We will add another branch step and check if we got any results from Zendesk (if not then there is nothing to inform Inbox about.
Similarly to what we did previously, we check via a Custom condition if the results[0].name variable contains any data.
Step 5: Update the Inbox contact
Now that we got the contact information back from Zendesk, it’s time to update the data on Inbox by using the Update Inbox contact step, passing the variables we saved earlier (results[0].name, results[0].phone, etc.) as shown below:
Step 6: Pass the information to Inbox
Now that we’ve ensured to get the latest customer information from Zendesk we can signal Inbox that a case can be created and assigned to an agent. Just add the Create Inbox Ticket step and keep the default configuration.
Step 7: Retrieve the updated Inbox contact information
During the conversation with the user, the agent might discover new information about the user (e.g. company name, email, etc.). While the agent will update the Inbox contact information, we want to make sure this information is synchronized back to Zendesk.
1. Let’s make sure the flow has access to the latest Inbox contact information. We’ll add another Http Fetch step, make a call to the V2 version of the Contacts API, and pass the contact ID.
2. Since the MessageBird APIs use API key authentication, we will also add an Authorization header of type AccessKey, followed by the MessageBird API key. You can find your key on MessageBird Dashboard, under Developers API access.
Step 8: Push latest contact information back to Zendesk
1. Use the Zendesk user URL we saved earlier to do an update (put) with the latest Inbox contact information:
The URL has to be results[0].url
The payload (body) follows the format described in the Zendesk documentation. In our case, we will be updating the first name and email fields
3. Publish your flow in the top right corner of your screen, and you're good to go! 2. Add the Authorization header specific to Zendesk calls (see step 3).
And that’s it! 🎉 Now you know how to connect Inbox to Zendesk using Flow Builder.