Creating an SMS AutoResponse

You can use both business rules and workflows to send automated SMS responses to initial-inbound messages. While both options result in the same general outcome, there are advantages and disadvantages of each. 

In this article we will go over the benefits and differences between automating SMS responses with business rules vs workflows and how you can do either. 

Prerequisites

  • Create a Twilio or Messagebird account to use in your SMS integration 

  • Set up SMS integration and connect the number to Kustomer

Business Rule

Using a business rule is the simplest way to set up an SMS auto-response and can be done in just a few minutes. The business rule editor allows you to use a template to generate a working auto-responder with the click of a button. From there you are able to customize your conditional logic and messaging to get it to fit your needs. While business rules are simpler and quicker they do lack some of the features available in a workflow. 

In order to create a business rule to send an SMS auto response, follow the guide below

  1. Create a rule using the template

  • Start by going to settings > platform > business rules and then clicking ‘add rule’

  • The best way to get started is to use a template 

    • Under ‘use cases’ click on ‘send message’ and select SMS acknowledgement auto response

  • This will set the rule up to trigger on the first-inbound interaction (first message sent in from the customer) and will add a condition to make sure the conversation was not imported. 

  • Lastly, it set up the ‘send message’ action to have SMS as the channel and your default SMS number as the ‘from’ number

  1. Add your conditions

  • The only condition added by the template is ‘conversation imported At is not set’

  • You will need to add any additional conditions you want to filter out which types of customers, conversations and messages will receive the auto response

  1. Customize your message

  • Add whatever text you want in your message body and format and style it to your liking

  • If you have more than one number in your org you can also choose which number you want to the auto response to be sent from 

  1. Activate and save the business rule

  • Finally, activate and save the rule to put it into action

Workflow 

Using a workflow to set up an SMS auto response allows for greater levels of customization than a business rule. Workflows give you access to a wider variety of attributes to use for conditions or include in your message body. In addition to sending the message, workflows also allow you to accomplish multiple tasks at or around the same time to further increase productivity. Workflows also give you the ability to delay the message being sent for a specific duration. 

In order to set up a workflow to send an automatic SMS reply on an inbound message, you will need to follow the guide below  

  1. Create an API key and save it as a workflow variable

  • Create an API key with org.hooks permission

    • Make sure you set they key to not expire so that the workflow does not stop working down the road due to an authentication error

  • Save API key as workflow variable

  1. Create the workflow trigger

  • Add ‘message created’ as the trigger 

    • This will only trigger the workflow for a new message created in Kustomer 

  1. Add condition steps

  • Add a condition step to make sure the message is the initial inbound message

    • This will ensure that sending a message from an agent to a customer does not result in an auto response being sent 

  • Add a condition step to make sure the message was not imported 

    • This is necessary to ensure that only active conversations with live customers are getting auto responses 

  1. Look up the conversation

  • Add a ‘conversation lookup’ step to get information on the conversation the message exists on

    • To do this, utilize the ‘conversation’ attribute from the message object (steps.1.conversation)

    • This value is the conversation ID

  1. Send the message via the API

  • Lastly, add a ‘Rest API: JSON’ step to send an API POST request to the /drafts endpoint. This will create send the SMS message

{

  'channel': 'sms',

  'conversation': '/#steps.1.conversation',

  'sendAt': '{{{date 'day' count=0}}}',

  'from': '/#steps.1.meta.to',

  'to': '/#steps.1.meta.from',

  'body': '<MESSAGE_BODY_HERE>'

}

  1. You will utilize the message data from step 1 and the conversation data from step 3 to fill in the request body

  2. The ‘sendAt’ value is what is used to tell the message to send immediately as opposed to on a delay

  • For your headers, you will need to utilize the API key you saved as a workflow variable. 

    1. The headers should also be formatted in JSON like so

{

  'Authorization': 'Bearer ',

  'Content-Type': 'application/json'

}

  1. Add your API key after “Bearer” by clicking the key icon and copy and pasting it

    1. This allows you to hide and protect your API key 

  • Lastly, you will need to make sure you select ‘true’ for the ‘json’ attribute 


 

Best Practices

  • In a workflow, save the API Key as workflow variable to avoid exposing the key

  • Utilize a custom attribute to avoid repeats and loops

    • Create a custom attribute on the conversation klass called ‘auto response sent’ with a ‘true/false’ value 

  • Add a condition in the business rule that prevents the message from being sent if ‘auto response sent’ is equal to true

  • In the ‘set actions’ section of the rule, add an action to ‘update data’ and set the value of ‘auto response sent’ to true

  • This will prevent multiple auto responses from being sent and limit the number of automated messages to 1 per conversation 

  • Markdown for styling message body

    • You can use markdown to format and style the body of your message

      • For example, add ** on either side of the text you want to make bold

        • **bold text**