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**