Set up an auto-response workflow for WhatsApp integrations
Last Update: Oct 2024 • Est. Read Time: 7 MINA common practice in the support industry is to send out an auto-reply after customers reach out to support to let them know that their message was received. This article explains how to set up an auto-response workflow when using the Twilio or MessageBird WhatsApp integrations.
Who can access this feature? | |
User types | Admins and any users with permission to access workflows. |
In this article
- Prerequisites
- Create the auto-response workflow
- Create an API key
- Create a workflow variable
- Customize the workflow
Prerequisites
Before setting up an auto-response workflow, you will need to have set up either the Twilio or the MessageBird app integrations in your organization. You will also need to be familiar with creating and editing workflows.
Create the auto-response workflow
Get started by creating the auto-response workflow.
- Go to Settings
and select Platform > Workflows.
- Select Add Workflow, then Custom Workflow, and give it a name and description.
- Click on the three dots next to the Save button and select Edit Workflow JSON.
- Remove the existing JSON and replace it with either the Twilio or MessageBird workflow code below.
- Select Save.
- If your organization is hosted on our EU server, select the Send Auto Response workflow step and replace the URI field with
https://api.prod2.kustomerapp.com
Twilio
{ "description": ".", "name": "whatsapp---auto-response", "steps": [ { "transitions": [ { "target": "eFYc7THaj", "condition": { "op": "neq", "values": [ "/#steps.1.auto", true ] }, "meta": { "name": "Not Auto Message" } } ], "errorCases": [], "id": "9k8uV34r_" }, { "transitions": [], "errorCases": [], "id": "eFYc7THaj", "action": "kustomer.rest-api.json", "params": { "method": "POST", "data": { "channel": "whatsapp", "app": "twilio_whatsapp", "conversation": "/#steps.1.conversation", "sendAt": "{{{date 'day' count=0}}}", "from": "/#steps.1.meta.to", "to": "/#steps.1.meta.from", "body": "ADD CUSTOM MESSAGE HERE" }, "headers": { "Authorization": "Bearer ADD_NEW_VARIBLE_HERE", "Content-Type": "application/json" }, "json": true, "uri": "https://api.kustomerapp.com/v1/customers/{{steps.1.customer}}/drafts" }, "appVersion": "kustomer-^1.8.5", "meta": { "displayName": "Send Auto Response" } }, { "transitions": [ { "target": "9k8uV34r_", "condition": { "op": "eq", "values": [ "/#steps.1.channel", "whatsapp" ] }, "meta": { "name": "WhatsApp?" } } ], "errorCases": [], "id": "kqymMuDO6" } ], "trigger": { "transitions": [ { "target": "kqymMuDO6", "condition": { "op": "eq", "values": [ "/#steps.1.directionType", "initial-in" ] }, "meta": { "name": "Initial Inbound?" } } ], "eventName": "kustomer.message.create", "id": "1", "appVersion": "kustomer-^1.8.5" } }
MessageBird
{ "description": ".", "name": "whatsapp---auto-response", "steps": [ { "transitions": [ { "target": "eFYc7THaj", "condition": { "op": "neq", "values": [ "/#steps.1.auto", true ] }, "meta": { "name": "Not Auto Message" } } ], "errorCases": [], "id": "9k8uV34r_" }, { "transitions": [], "errorCases": [], "id": "eFYc7THaj", "action": "kustomer.rest-api.json", "params": { "method": "POST", "data": { "channel": "whatsapp", "app": "messagebird", "conversation": "/#steps.1.conversation", "sendAt": "{{{date 'day' count=0}}}", "from": "/#steps.1.meta.to", "to": "/#steps.1.meta.from", "body": "ADD CUSTOM MESSAGE HERE" }, "headers": { "Authorization": "Bearer ADD_NEW_VARIBLE_HERE", "Content-Type": "application/json" }, "json": true, "uri": "https://api.kustomerapp.com/v1/customers/{{steps.1.customer}}/drafts" }, "appVersion": "kustomer-^1.8.5", "meta": { "displayName": "Send Auto Response" } }, { "transitions": [ { "target": "9k8uV34r_", "condition": { "op": "eq", "values": [ "/#steps.1.channel", "whatsapp" ] }, "meta": { "name": "WhatsApp?" } } ], "errorCases": [], "id": "kqymMuDO6" } ], "trigger": { "transitions": [ { "target": "kqymMuDO6", "condition": { "op": "eq", "values": [ "/#steps.1.directionType", "initial-in" ] }, "meta": { "name": "Initial Inbound?" } } ], "eventName": "kustomer.message.create", "id": "1", "appVersion": "kustomer-^1.8.5" } }
Create an API key
Next, you will create an API key to send out auto-response messages.
- Go to Settings
and select Security > API Keys.
- Select + Add API Key.
- Name the API key, give it
org.permission.draft.create
,org.user.draft.read
, andorg.user.draft.write
permissions, then select Create. - Copy the API key and save it locally so it can be easily referenced later.
Create a workflow variable
Now that an API key has been created, it can be added to the workflow with a workflow variable. Workflow variables allow you to store API keys securely and access them from within your auto-response workflow. Follow these steps to get started:
- Go to Settings
and select Platform > Workflows to edit the workflow that was created earlier.
- Next to the Save button, open the menu
and select (x) Workflow Variables.
- Select + Add and name the variable.
- Paste the API Key from before in the Value field and select Save.
You will now be able to add the API Key to your workflow:
- Select the Send Auto Response workflow step and scroll down to the Headers field.
- Select the Key
and select the variable that was just created.
- Remove the
ADD_NEW_VARIABLE_HERE
text and replace it with the copied workflow variable.
Customize the workflow
With the workflow variable created and added, all that is left to do is edit the body of the auto-response message as desired.
- Select the Send Auto Response workflow step and scroll down to the Data field.
- Next to body, replace the
ADD CUSTOM MESSAGE HERE
text with whatever you'd like to include in the auto-response message. - Select the toggle next to Save to turn on your workflow.
Once you turn on the workflow, an auto-response message will be sent out to your customers whenever they send in a WhatsApp message.