See related
No related articles

Manage and reroute customer-ended chats

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

When configuring your Chat Management settings, you have the option of allowing customers to end a chat conversation without agent intervention. Customer-ended chat conversations are given a wrap-up status, which exempts them from being sent to a queue or assigned to an available user.

If you would instead prefer for these conversations to be assigned to an agent for followup, you can set up a workflow to change the status of chats in this state. This article will walk through setting up a custom workflow to automate this process.

Who can access this feature?
User typesAdmins can access workflows and API keys.


In this article

Prerequisites

Before following this guide, you should already be comfortable with the basics of using workflows. Workflows overview

Overview

When configuring your Chat Management settings, you can use the Allow chats to be ended setting to give customers the ability to end conversations without agent intervention.

When this setting is turned on, customers will see an option within the chat widget to end the chat.

After a customer ends a chat, this change in status will be displayed to agents while viewing the conversation in the timeline.

Organizations that use Queues & Routing will typically see that conversations are given the queued status as soon as they are ready to be routed to a queue. However, chat conversations that are ended by a customer will be given the wrap-up status, which exempts it from being routed through a queue.

You can use a workflow to modify this status and allow customer-ended chats to be queued and routable.

Create the workflow

First, you'll set up the workflow to assign conversations.

  1. Go to Settings> Platform > Workflows.
  2. Select Add Workflow > Custom Workflow.
  3. The New Workflow modal will appear. Fill out the Workflow Title. Add a description to help remember what function this workflow serves in the future.
  4. Leave the callable workflow option turned off.
  5. Select Create to save the workflow. You'll be taken to the Workflow Editor where the workflow can be customized.

Add the workflow JSON

Next, use the Workflow Editor to paste in the workflow JSON code provided below. This JSON will take care of most of the workflow creation.

  1. In the Workflow Editor, open the Workflow Optionsmenu and select Edit Workflow JSON.
  2. A modal appears where you can edit the code for this workflow. Select and delete all the current JSON code.
  3. Copy the below code block, and paste it into the JSON text field in your Workflow Editor. Then, select Update to save the changes to the workflow and dismiss the JSON editor.
  {
  "description": "",
  "name": "reopen-customer-ended-chats",
  "steps": [
    {
      "transitions": [
        {
          "target": "Hi-ehc4s2",
          "condition": {
            "op": "true",
            "values": [
              true
            ]
          }
        }
      ],
      "errorCases": [],
      "id": "Hz1ljz_jv",
      "appVersion": "kustomer-^1.9.2",
      "meta": {
        "displayName": "Find Conversation ID"
      }
    },
    {
      "transitions": [
        {
          "target": "wNsptI0nS",
          "condition": {
            "op": "true",
            "values": [
              true
            ]
          }
        }
      ],
      "errorCases": [],
      "id": "Hi-ehc4s2",
      "appVersion": "kustomer-^1.8.2"
    },
    {
      "transitions": [
        {
          "target": "q67aVoU1D",
          "condition": {
            "op": "contains",
            "values": [
              "/#steps.1.changes.attributes.endedReason.after",
              "customer_ended"
            ]
          },
          "meta": {
            "name": "Chat is ended by Customer"
          }
        }
      ],
      "errorCases": [],
      "id": "wNsptI0nS"
    },
    {
      "transitions": [
        {
          "target": "GZfzOWZfM",
          "condition": {
            "op": "or",
            "values": [
              {
                "op": "dne",
                "values": [
                  "/#steps.1.changes.attributes.endedReason.before",
                  ""
                ]
              },
              {
                "op": "not-contains",
                "values": [
                  "/#steps.1.changes.attributes.endedReason.before",
                  "customer_ended"
                ]
              }
            ]
          },
          "meta": {
            "name": "Chat was not ended previously"
          }
        }
      ],
      "errorCases": [],
      "id": "q67aVoU1D"
    },
    {
      "transitions": [
        {
          "target": "0jAm_Nng3",
          "condition": {
            "op": "true",
            "values": [
              true
            ]
          }
        }
      ],
      "errorCases": [],
      "id": "GZfzOWZfM"
    },
    {
      "transitions": [
        {
          "target": "bu611hhqK",
          "condition": {
            "op": "true",
            "values": [
              true
            ]
          },
          "meta": {
            "name": "Conversation does not yet have em"
          }
        }
      ],
      "errorCases": [],
      "id": "0jAm_Nng3"
    },
    {
      "transitions": [],
      "errorCases": [],
      "id": "bu611hhqK",
      "action": "kustomer.conversation.update",
      "params": {
        "id": "/#steps.1.id",
        "ended": false
      },
      "appVersion": "kustomer-^1.9.2",
      "meta": {
        "displayName": "Update Conversation"
      }
    }
  ],
  "trigger": {
    "transitions": [
      {
        "target": "Hz1ljz_jv",
        "condition": {
          "op": "true",
          "values": [
            true
          ]
        }
      }
    ],
    "eventName": "kustomer.conversation.update",
    "id": "1",
    "appVersion": "kustomer-^1.9.2"
  }
}

The workflow will look like this:

Customize the workflow

Last, use the Workflow Editor to make any other desired changes to this automation. In the Update Conversation step of the workflow, you can add further changes you'd want the workflow to carry out on the conversation, such as moving the conversation to a queue, team, or add a tag.

When you're finished, Save all and other workflow changes, and use the toggle to turn on the workflow.