See related
No related articles

Set up an auto-response workflow for WhatsApp integrations

Last Update: Oct 2024 • Est. Read Time: 7 MIN
To check plan availability, see the pricing page.

A 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 typesAdmins and any users with permission to access workflows.


In this article

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.

  1. Go to Settings  and select Platform > Workflows.
  2. Select Add Workflow, then Custom Workflow, and give it a name and description.
  3. Click on the three dots next to the Save button and select Edit Workflow JSON.
  4. Remove the existing JSON and replace it with either the Twilio or MessageBird workflow code below.
  5. Select Save.
  6. 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.

  1. Go to Settings  and select Security > API Keys.
  2. Select + Add API Key.
  3. Name the API key, give it org.permission.draft.create, org.user.draft.read, and org.user.draft.write permissions, then select Create.
  4. 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:

  1. Go to Settings  and select Platform > Workflows to edit the workflow that was created earlier.
  2. Next to the Save button, open the menu and select (x) Workflow Variables.
  3. Select + Add and name the variable.
  4. 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:

  1. Select the Send Auto Response workflow step and scroll down to the Headers field.
  2. Select the Key and select the variable that was just created.
  3. 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.

  1. Select the Send Auto Response workflow step and scroll down to the Data field.
  2. Next to body, replace the ADD CUSTOM MESSAGE HERE text with whatever you'd like to include in the auto-response message.
  3. 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.