Integrate your Certainly bot with Kustomer

Untitled.png

In this article, you'll learn how to set up the Certainly chat integration with Kustomer. We'll explore how to:

You will be able to deploy this integration on any website you own, as long as it allows third-party scripts.

Integrate with Kustomer Email Support

Once complete, this integration will allow your chatbot to create an email conversation on behalf of the visitor as a ticket in the Kustomer platform. This way, your Certainly bot will always act as your first level of support, while your human agents only intervene via email when needed.

Check out a video of the solution:

Configure a handover to Kustomer Email Support

Now we'll explain how to set up and test the handover.

  1. On Kustomer, create a new Team with Administrator permissions and add your agents. Read more about how to create, manage, and use Teams in Kustomer's documentation. This team will be used by Certainly when forwarding tickets to your support agents.

  2. Generate an API Key for the support team. This API Key will be used to authenticate Certainly Webhook requests to your Kustomer account. Learn more about how to manage Kustomer API Keys.

  3. Next, you'll need to configure your bot on the Certainly Platform. Following the steps below, your chatbot will be ready to create email conversations when the end user needs it.
    mceclip0.png

  4. Save and publish your Certainly bot using the appropriate buttons in the Navigation bar at the top of your bot canvas:
    mceclip1__2_.png

  5. Create an Instance of the wh_iconKustomer Get customer by email Webhook Template.
    • Fill in the Authentication's Bearer Token with your Kustomer API Key
      mceclip4.png
    • Fill in the Context's “email” field with the email Custom Variable your visitors will input within your bot's conversation, such as “”.
      mceclip3.png
    • Fill in the Context's “domain” field with the correct domain from your Kustomer account environment. In the example below, the domain is “certainly”.
      mceclip2.png     mceclip5.png

  6. Create an Instance of the wh_iconKustomer Create user Webhook Template.
    • Fill in the Authentication's Bearer Token with your Kustomer API Key
      mceclip4.png

    • Fill in the Context's “domain” field with the correct domain from your Kustomer account environment. In the example below, the domain is “certainly”.
      mceclip2.png     mceclip5.png
    • Fill in the Body's “email” and “name” fields with the email and name Custom Variables your visitors will input within your bot's conversation, such as “” and “”.
      mceclip0.png

  7. Create an Instance of the wh_iconKustomer Create conversation Webhook Template.
    • Fill in the Authentication's Bearer Token with your Kustomer API Key
      mceclip4.png

    • Fill in the Context's “domain” field with the correct domain from your Kustomer account environment. In the example below, the domain is “certainly”.
      mceclip2.png     mceclip5.png
    • Fill in the Body's “tags” field with the text tag you'd like to use on your visitor's requests, such as “handed_over_from_certainly”. Fill in the “customer” field with the customer ID Custom Variable obtained from the Webhook execution in Steps 5 and 6 (“”). Fill in the “name” field with the message subject your visitors will input within your bot's conversation, such as “”.
      mceclip1.png

  8. Create an Instance of the wh_iconKustomer Create note within conversation Webhook Template.
    • Fill in the Authentication's Bearer Token with your Kustomer API Key
      mceclip4.png

    • Fill in the Context's “domain” field with the correct domain from your Kustomer account environment. In the example below, the domain is “certainly”.
      mceclip2.png     mceclip5.png
    • Fill in the Body's “chatHistory” field with the chat history Custom Variable you will use within your bot, such as “”.
      mceclip3.png

  9. Create an Instance of the wh_iconKustomer Create message Webhook Template.
    • Fill in the Authentication's Bearer Token with your Kustomer API Key
      mceclip4.png
    • Fill in the Context's “domain” field with the correct domain from your Kustomer account environment. In the example below, the domain is “certainly”.
      mceclip2.png     mceclip5.png
    • Fill in the Body's “customer” field with the customer ID Custom Variable obtained from the Webhook execution in Steps 5 and 6 (“”). Fill in the “conversation” field with the conversation ID Custom Variable obtained from the Webhook execution in Step 8 (“”).
      mceclip4.png

  10. Create an Instance of the wh_iconKustomer Check Agent Availability Webhook Template.
    • Fill in the Authentication's Bearer Token with your Kustomer API Key
      mceclip4.png

    • Fill in the Context's “domain” field with the correct domain from your Kustomer account environment. In the example below, the domain is “certainly”.
      mceclip2.png     mceclip5.png

  11. Create an Instance of the wh_iconCertainly Get Conversation History Webhook Template.

  12. Return to your chatbot canvas and refresh the page. Otherwise, you won't be able to see the newly created Webhooks.

  13. Inside the <md>Retrieve chat history Module, insert your Webhook instance wh_iconCertainly Get Conversation History. It should look like this:
    mceclip7.png

  14. Inside the <md>Checking agent availability Module, insert your Webhook instance wh_iconKustomer Check Agent Availability, which checks if there are agents available.

    Using the setup shown below, if there is an agent available, the bot will follow the "Agents available" flow. If there are no agents available, the bot will follow the "No available agents" flow.
    mceclip8.png

  15. Inside the <md>Create Ticket on Kustomer Module, create the following Connections:

    15A. Insert your Webhook instance wh_iconKustomer Get customer by email, which checks if a customer's email already exists. Using the setup shown below, if a customer does not already exist, it will create a new customer. 

    15B. Insert your Webhook instance wh_iconKustomer Create user.

    15C. Insert your Webhook instance wh_iconKustomer conversation.

    15D. Insert your Webhook instance wh_iconKustomer Create note within conversation.

    15E. Insert your Webhook instance wh_iconKustomer message, which checks if the ticket creation throws an error.

    Using the setup shown below, if there is an error, the bot will follow the "Error" flow. If the ticket was created successfully, the bot will follow the "Ticket created on Kustomer" flow.
    mceclip0.png

  16. Save and publish your Certainly bot using the appropriate buttons in the Navigation bar at the top of your bot canvas:
    mceclip1__2_.png

Once the setup is complete, we suggest running a test to make sure everything is working properly.

Integrate with Kustomer Live Chat

This integration allows your Certainly chatbot to seamlessly hand over a live conversation to Kustomer. Your agents can pick up the conversation from the Kustomer platform and chat in real time with the visitor to solve any request. 

Check out a video of the solution below:

Below, we'll explain how to set up the handover and deploy the integration on your website: 

Configure a handover to Kustomer Live Chat

  1. Activate Kustomer's chat to integrate it with Certainly and make a copy of your brandId and data-kustomer-api-key, as indicated below. Read more about how to activate Kustomer Chat in their documentation.
    mceclip0.png

  2. Next, you'll need to configure your bot on the Certainly Platform. Following the steps below, your chatbot will be ready to create, update, and end live chat conversations when the end user needs it.
    mceclip1.png

  3. Save and publish your Certainly bot using the appropriate buttons in the Navigation bar at the top of your bot canvas:
    mceclip1__2_.png

  4. If you haven't done so before, create an Instance of the wh_iconKustomer Check Agent Availability Webhook Template.
    • Fill in the Authentication's Bearer Token with your Kustomer API Key.
      mceclip4.png

    • Fill in the Context's “domain” field with the correct domain from your Kustomer account environment. In the example below, the domain is “certainly”.
      mceclip2.png     mceclip5.png

  5. If you haven't done so before, create an Instance of the wh_iconCertainly Get Conversation History Webhook Template.

  6. Return to your chatbot canvas and refresh the page. Otherwise, you won't be able to see the newly created Webhooks.

  7. Inside the <md>Retrieve chat history Module, insert your Webhook instance wh_iconCertainly Get Conversation History. It should look like this:mceclip7.png

  8. Inside the <md>Checking agent availability Module, insert your Webhook instance wh_iconKustomer Check Agent Availability, which checks if there are agents available.

    Using the setup shown below, if there is an agent available, the bot will follow the "Agents available" flow. If there are no agents available, the bot will follow the "No available agents" flow.
    mceclip8.png

  9. Inside the <md>Agents available Module, configure a trigger for the handover as follows:
    mceclip2.png
    With this setup, as soon as the bot lands on the next Module, the handover to Kustomer Chat will be executed.

  10. Inside the <md>Chat handed over to Kustomer Module, configure its Connections and Custom Variables as follows:
    mceclip3.png

  11. Inside the <md>Idle bot state Module, configure its Connections and Custom Variable as follows:
    mceclip4.png

Deploy a Kustomer Live Chat integration on your website

Finally, you'll need to deploy both Kustomer Chat and Certainly on your website.

Embed the snippet below into your website, replacing the Kustomer Chat script and the Certainly bot ID with your own:

html
<!DOCTYPE html>
<html>
<body>
<!--Kustomer Core Widget Start-->
<script src="https://cdn.kustomerapp.com/chat-web/core.js"
data-kustomer-api-key='ADD_HERE_KUSTOMER_API_KEY'></script>
<script>
const kustomer_brand_id = 'ADD_HERE_KUSTOMER_BRAND_ID'
</script>
<!--Kustomer Core Widget End-->

<!--Certainly Widget Start-->
<script src="https://app.certainly.io/sdk/webchat.js"></script>
<script>
var certainly_settings = {
id: "ADD_HERE_CERTAINLY_BOT_ID",
mode: "clear_past_conversations",
inputType: "bottom",
cvars: {
// Metadata can be passed to the bot
// visitor_name: "John",
// visitor_email: "jd@email.com"
},
kustomer_events: {
takeover_module: "ADD_HERE_CHAT_ENDED_ON_KUSTOMER_MODULE_ID",
agent_joined_message: "An agent has joined the conversation",
bot_joined_message: "Bot has joined the conversation",
agent_left_message: "An agent has left the conversation",
bot_left_message: "Bot has left the conversation"
}
}
initCertainlyWidget(certainly_settings);
</script>
<!--Certainly Widget End-->

<!--Kustomer extension for Certainly-->
<script src="https://scripts.certainly.io/extensions/kustomer/kustomer.js"></script>
<!--Kustomer extension for Certainly-->
</body>
</html>

Great work - now your bot is fully integrated with Kustomer! If you encounter any problems in the configuration or have other questions about the setup, just reach out to our Customer Success team.