Kustomer and Slack Integration

Written by Erinn Nelson, Principal Technical Support Engineer @ Kustomer

Many of Kustomer’s clients may be familiar with Slack, a online messaging platform dedicated to helping teams communicate.

Users of Slack often rely on the system, not just for communication with peers, but for notifications and other automated messages as well. It is not uncommon for Kustomer to receive requests on integrating Slack for various uses. While no formal Slack integration currently exists in Kustomer’s ecosystem, building your own custom integration is a relatively simple process when using Kustomer Workflows!

There is almost limitless potential to the uses of a Kustomer + Slack integration, including Conversation spot checks, receiving Customer CSAT scores, confirming background automations, and more!

This post will cover basic Slack building blocks, and go over the construction of a Workflow that notifies a Slack Channel whenever a Conversation has been reopened by a Customer.

  

Creating a Slack App

Both Slack and Kustomer use an internet communication system called “Webhooks” to send and receive information, and this can be leveraged to connect the two systems together. Slack’s own Webhook documentation is comprehensive and can help even beginners in getting started.

The first steps in this process are detailed in Slack’s documentation (linked above), but they will be listed here as well. To start, you will need to create a Slack App in your Slack workspace (be aware that this may require some level of permission from your workspace admin). You can create your Slack app here: https://api.slack.com/apps?new_app=1

Choose a descriptive name and a workspace with which to associate your app, and then click “Create App”.

After creating, you should be redirected to the settings page for your new app (if you are using an existing app, just load its settings via your app's management dashboard).

From here, select the “Incoming Webhooks” feature, and click the “Activate Incoming Webhooks” toggle to turn it on.

Now that Incoming Webhooks are enabled, the settings page should refresh with some additional options. Find and click the button marked “Add New Webhook to Workspace”.

Clicking this button will start the installation process for your new app! Pick a channel to which the app should post messages (keep in mind that you may end up posting many messages during testing, which other Slack users in the channel may see), before clicking to Authorize.

From here you should be sent back to your app settings, where you will see a new entry under the Webhook URLs for Your Workspace section. Your Webhook should look something like this:

https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

This URL is a basic Slack inbound Webhook, which will be used to receive information sent into Slack.

Kustomer Workflow

Workflows are Kustomer’s most advanced automations tool. Many users may find Workflows, at first, to be too complex to approach. Fortunately, Kustomer provides several resources for beginners who wish to learn the basics of Workflow structure. Please make use of the free lessons and live-recorded sessions available in Kustomer University.

The following steps will guide you through a basic Workflow that sends a message to your 

Slack channel whenever a Conversation is reopened by a Customer. You can build and expand on the concepts and ideas found here to create your own custom integration.

Step 1: Trigger Step

  • Trigger App: Kustomer

  • Trigger Event: Conversation Updated

The specifics of your own Trigger Step may vary greatly, depending on the intended purpose of any revised integration. This particular Workflow will run whenever an existing Conversation receives an update

Step 2: Condition Step

  • Continue Only If

steps.1.changes.attributes.status.before

Equals

done

  • Add Condition “AND” Continue Only If

steps.1.changes.attributes.status.after

Equals

open

  • Add Condition “AND” Continue Only If

steps.1.changes.attributes.inboundMessageCount.after

Greater than

steps.1.changes.attributes.inboundMessageCount.before

The specifics of a Condition Step for any revised integration will certainly vary and be highly contextual to your own purposes. This Condition Step checks that the Conversation Update events included a status change from “done” to “open”, as well as a rise in the inbound message count

Step 3: Action Step

  • Action App: Kustomer

  • Action Event: REST API JSON

  • Uri: Insert your inbound Webhook from Slack here

  • Method: POST

  • Data: {

         “text”: 'A Kustomer Conversation has been reopened for Customer ID {{steps.1.customer}}: https://kustomer.kustomerapp.com/app/conversations/{{steps.1.id}}'

}

  • Headers: {

    'Content-Type': 'application/json'

}

  • Json: true

This Action Step is the important part! You can use it to send whatever text you like to your Slack Channel. You can even use handlebars to insert information or build a link.

You can always add more dynamic information to your message by including additional Workflow steps. If you wish to include the Customer’s name for instance, you will need to find the Customer by ID and interpolate the Customer’s name attribute in your Slack text.

Be sure to save your Workflow and turn it on (you may also wish to activate view logs for troubleshooting purposes). To test, you will need to reopen an existing Conversation by writing in as a Customer.

Creating a system of notifications in Slack can be incredibly beneficial to your day-to-day flow! For more advanced Slack options, please review Slack’s additional documentation on advanced formatting, posting replies and more!  Try this out, or implement your ideas with customized Workflows, and as always, please reach out to the Kustomer Support team if you have any questions or need of assistance!