Workflow tutorials
Use workflow templates to quickly set up common automation tasks.Articles
Workflow Templates
Workflows are one of the most powerful features in Kustomer, and Workflow Templates help you to get started with them even faster. You can find and use these templates in the Workflows Template Gallery.To access the gallery, go to Settings > Platform > Workflows.Hover your cursor over a template to see a description of how it can be used.To get started, select Use This Workflow. The Workflow Editor will open where you can then adjust the template to fit your team's needs.The following templates are currently available to all organizations:Assign Based On Receiving Email - Assign email conversations to the appropriate team based on the email address the message was sent to.Tag Conversation Based On Customer Attribute - Assign a "VIP" tag to all conversations created for customers who have a vipBool field set to true.Tag Conversation Based On Email Content - Check the subject and body on new email conversations and automatically tag them based on keywords found.Related articlesWorkflows overviewUse Slack notifications
If your team uses Slack, you can set up a Kustomer workflow to notify a channel whenever a new chat message comes in. This article will walk you through the steps to create a workflow so that you never miss another inbound chat from a customer.Who can access this feature?User typesAdmins can create workflows.In this articlePrerequisitesFind your Slack Webhook URLCreate the WorkflowEnter the Workflow JSON codePrerequisitesBefore following this guide, we recommend that you already be comfortable with the basics of using Workflows: Workflows OverviewYou will need to have an active Slack account, and have an understanding of using webhooks and working with developer APIs. These two documents cover necessary background information that will be applied in this walkthrough:Slack API: Sending messages using Incoming WebhooksKustomer API: Calling a REST API within a WorkflowFind your Slack Webhook URLBefore you can begin the setup process in Kustomer, you'll need to create an incoming webhook in Slack. To set this up, follow these steps from the Slack API: Sending messages using Incoming Webhooks. When this setup is complete, make note of your webhook URL; you'll need this later on in the setup process in the Kustomer settings. Your Slack webhook URL will be formatted like this:https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXXCreate the WorkflowNow, you'll open up Kustomer. The first step will be to create the workflow.Go to Settings > Platform > Workflows.Select Add Workflow.The New Workflow modal will appear. Fill out the Workflow Title; you can leave the Description field blank because our code snippet will provide this for you.Select Create to save the workflow and begin working in the Workflow Editor.Enter the Workflow JSON codeYou will then use the Workflow Editor to paste in a workflow code supplied below. This JSON code will take care of most of the workflow creation, aside from a few placeholder values that you'll need to update manually.In the Workflow Editor, use the Workflow Optionsto select Edit Workflow JSON.A modal appears where you can edit the code for this workflow directly. Select and delete the current JSON code.Copy this code block, and paste it into the JSON text field in your Workflow Editor:{ "description": "Posts to Slack whenever a message is created with message conversation details.", "name": "slack", "steps": [ { "id": "eeWBChdww", "transitions": [ { "meta": { "name": "Email or SMS?" }, "condition": { "values": [ { "values": [ "/#steps.1.channel", "email" ], "op": "contains" }, { "values": [ "/#steps.1.channel", "sms" ], "op": "contains" } ], "op": "or" }, "target": "cSS3Gw1fV" } ] }, { "appVersion": "kustomer-^1.2.1", "params": { "identifier": "/#steps.1.customer" }, "action": "kustomer.customer.find", "id": "cSS3Gw1fV", "transitions": [ { "condition": { "values": [ true ], "op": "true" }, "target": "VIK9f-WHk" } ] }, { "appVersion": "kustomer-^1.2.1", "params": { "id": "/#steps.1.conversation" }, "action": "kustomer.conversation.find-by-id", "id": "VIK9f-WHk", "transitions": [ { "meta": { "name": "Inbound?" }, "target": "eH6zZmIOm", "condition": { "op": "eq", "values": [ "/#steps.1.direction", "in" ] } } ] }, { "appVersion": "kustomer-^1.2.1", "params": { "headers": { "Content-Type": "application/json" }, "uri": "SLACKHOOKHERE", "method": "POST", "json": true, "data": { "attachments": [ { "fallback": "New message in Kustomer for conversation: {{steps.VIK9f-WHk.name}}", "pretext": "New message in Kustomer for conversation {{steps.1.conversation}}", "title": "Go to conversation", "title_link": "https://ORGNAME.kustomerapp.com/app/conversations/{{steps.1.conversation}}", "color": "#D00000", "fields": [ { "title": "Event", "value": "Outbound Message Created", "short": false }, { "title": "Customer Name", "value": "/#steps.cSS3Gw1fV.name", "short": false }, { "title": "Subject", "value": "/#steps.VIK9f-WHk.name", "short": false }, { "title": "Conversation Status", "value": "/#steps.VIK9f-WHk.status", "short": false }, { "title": "Message Direction", "value": "/#steps.1.direction", "short": false }, { "title": "Message Body", "value": "/#steps.1.preview", "short": false } ] } ], "username": "Kustomer", "channel": "#CHANNELNAME" } }, "action": "kustomer.rest-api.json", "id": "eH6zZmIOm", "transitions": [] } ], "trigger": { "transitions": [ { "meta": { "name": "Filter imported messages" }, "condition": { "values": [ "/#steps.1.importedAt" ], "op": "dne" }, "target": "eeWBChdww" } ], "eventName": "kustomer.message.create", "id": "1", "appVersion": "kustomer-^1.2.1" } }On the following lines, update the placeholder strings as follows:line 83: SLACKHOOKHERE - The webhook URL from Slack, which you located earlier.line 92: ORGNAME - Your Kustomer org subdomain.line 129: #CHANNELNAME - The Slack channel where you want notifications to be posted.Select Update to dismiss the JSON editor and save the changes to this workflow.If there are any other changes to this workflow that you'd like to make, you can do so now. When you're finished, Save and exit the Workflow Editor.When you're ready to activate this workflow, use the toggle in the Workflow Settings to switch it on or off.Dynamically assign an agent's team to conversations
While business rules let you assign conversations to a specific team, you may instead prefer a conversation's assigned team to be updated dynamically based on an agent's work session and the team they were logged in to when the conversation was assigned to them. Or, you may want to remove the assigned team automatically when a user is unassigned, so that the conversation's assigned team is refreshed when a different user is assigned. Workflows can automate both of these processes.Who can access this feature?User typesAdmins can access workflows and API keys.In this articlePrerequisitesCreate an API keyCreate the workflowAdd the workflow JSONAdd the API key to the workflowCustomize the workflowPrerequisitesBefore following this guide, you should already be comfortable with the basics of using workflows. Workflows overviewWe also recommend being familiar with creating API keys and adding workflow variables.Create an API keyFirst, you'll need to set up the API key to use with the workflow.Create an API key.When setting up your new API key, assign it with the roles org.user.routing.read and org.permission.routing.read.Then, keep the token in a secure location to use later in this guide.Create the workflowNext, you'll set up the workflow to assign conversations.Go to Settings> Platform > Workflows.Select Add Workflow > Custom Workflow.The New Workflow modal will appear. Fill out the Workflow Title. You can leave the Description field blank because the code snippet below will provide this for you.Leave the callable workflow option turned off.Select Create to save the workflow. You'll be taken to the Workflow Editor where the workflow can be customized.Add the workflow JSONThen, Use the Workflow Editor to paste in the workflow JSON code provided below. This JSON will take care of most of the workflow creation.In the Workflow Editor, open the Workflow Optionsmenu and select Edit Workflow JSON.A modal appears where you can edit the code for this workflow. Select and delete all the current JSON code.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": "Assigns the team to a conversation based on the assigned user's team in their current work session. Also unassigns the team if a user is unassigned.", "name": "assign-team-on-user-assignment", "steps": [ { "transitions": [ { "target": "MtNv8EMuK", "condition": { "op": "and", "values": [ { "op": "exists", "values": [ "/#steps.K_bX_LCYn.id", "" ] }, { "op": "dne", "values": [ "/#steps.K_bX_LCYn.deletedAt", "" ] } ] }, "meta": { "name": "Assigned User Found" } } ], "errorCases": [], "id": "K_bX_LCYn", "action": "kustomer.user.find-by-id", "params": { "id": "/#steps.1.assignedUsers.0" }, "meta": { "displayName": "Find Assigned User" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "hLKnq3Vye", "condition": { "op": "eq", "values": [ "/#steps.MtNv8EMuK.response.statusCode", "200" ] }, "meta": { "name": "User is in Online Work Session" } } ], "errorCases": [], "id": "MtNv8EMuK", "action": "kustomer.rest-api.json", "params": { "uri": "https://api.kustomerapp.com/v1/routing/users/{{{steps.K_bX_LCYn.id}}}/work-sessions/current", "method": "GET", "headers": { "Authorization": "Bearer", "Content-Type": "application/json" }, "json": true }, "appVersion": "kustomer-^1.9.2", "meta": { "displayName": "Find Assigned User's Current Work Session" } }, { "transitions": [ { "target": "kAEdWGR5T", "condition": { "op": "exists", "values": [ "/#steps.MtNv8EMuK.response.body.data.relationships.team.data.id", "" ] }, "meta": { "name": "Assigned User Is Logged in to a Team" } } ], "errorCases": [], "id": "hLKnq3Vye" }, { "transitions": [], "errorCases": [], "id": "kAEdWGR5T", "action": "kustomer.conversation.assign-team", "params": { "id": "/#steps.1.id", "team": "/#steps.MtNv8EMuK.response.body.data.relationships.team.data.id" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "U2B0NRL5q", "condition": { "op": "exists", "values": [ "/#steps.1.assignedTeams.0", "" ] }, "meta": { "name": "Conversation Has Assigned Team" } } ], "errorCases": [], "id": "FrGZLHeS5" }, { "transitions": [], "errorCases": [], "id": "U2B0NRL5q", "action": "kustomer.conversation.assign-team", "params": { "id": "/#steps.1.id", "team": [] }, "meta": { "displayName": "Unassign Team from Conversation" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "K_bX_LCYn", "condition": { "op": "or", "values": [ { "op": "dne", "values": [ "/#steps.1.changes.attributes.assignedUsers.before.0", "" ] }, { "op": "neq", "values": [ "/#steps.1.changes.attributes.assignedUsers.before.0", "/#steps.1.changes.attributes.assignedUsers.after.0" ] } ] }, "meta": { "name": "Conversation Previously Unassigned or Assigned to a Different User" } } ], "errorCases": [], "id": "7jVAP0q_Y" } ], "trigger": { "transitions": [ { "target": "7jVAP0q_Y", "condition": { "op": "exists", "values": [ "/#steps.1.changes.attributes.assignedUsers.after.0", "" ] }, "meta": { "name": "Conversation is Assigned to a User" } }, { "target": "FrGZLHeS5", "condition": { "op": "and", "values": [ { "op": "exists", "values": [ "/#steps.1.changes.attributes.assignedUsers.before.0", "" ] }, { "op": "dne", "values": [ "/#steps.1.changes.attributes.assignedUsers.after.0", "" ] } ] }, "meta": { "name": "Conversation is Unassigned from a User" } } ], "eventName": "kustomer.conversation.update", "id": "1", "appVersion": "kustomer-^1.9.2" } } The workflow will look like this:Add the API key to the workflowReopen the Workflow Optionsmenu and select Workflow Variables.Add the saved token from the API key you created earlier as a workflow variable. Name the workflow variable as desired and add the token in the Value field.Save the variable, select Close to exit the workflow editor, and save the updated workflow.Customize the workflowIn Step 5 of the workflow, select the key icon in the REST API JSON action step to access the workflow variable saved, and copy the workflow variable.Add a single space after Bearer in the Headers section, and paste the copied value which is the API token needed for authorization. Set the JSON (boolean) field to true.If there are any other changes to the workflow that you'd like to make, do so now. When you're finished, Save all and other workflow changes, and use the toggle to activate the workflow.Requeue snoozed conversations that reopen while an agent is offline
When agents sign off for the day to end their shifts, a lot of their conversations may still be in the snoozed status. When those conversations receive a reply from the customer and reopen, It is useful to requeue those conversations so another available agent can get that conversation routed to them. This will help provide your customers an instant reply, rather than making them wait for the original agent to come back online. This can be set up by configuring a few settings and adding the workflow linked below. This workflow can be adjust to cater to your organization's specific needs and any unique user statuses you may have.Who can access this feature?User typesAdmins and any users with permission to access workflows.In this articleSet up workflowCreate API keyAdd API key to workflowJSON code for workflowSet up workflowThis workflow will be triggered on a conversation update step, and then it will check if the conversation that was update changed from a status of Snoozed to Open. If it has, then the workflow will make an HTTP GET request and check if the assigned user of the conversation is in an available status or not. Finally, if the assigned user is unavailable, it will unassign the user and put the conversation back in the queue to get routed to another available user to take action.Download the JSON code for workflow.Go to Settings> Platform > Workflows.Select Add Workflow.Choose Import Workflow.Select Select File.Select the JSON code file.Select Save.Create API keyThe third step of the workflow is an HTTP GET request to fetch the available user's current status. For this step to work we will need to create an API key and then add it to the workflow.Go to Settings> Security >API KeysSelect Add API Key.Give the API Key a Name.Under Role, add org.user.routing.read.Select No Expiration for Expires (in days)Select CreateCopy the token and save it to a secure location to use in the next step.Add API key to workflowNow that the API key has been created, it will need to be added to the workflow to support the HTTP GET request. Add the API key to the workflow, and then create a variable to be used in step three of the workflow. In the Workflow Editor, open the Workflow Options menu and select Workflow Variables.Give the variable a Name.Paste the API Key that was saved earlier in the Value section.Select Save.On the REST API: Generic steps, select the key icon in the Headers field.Select the variable you just created to copy it to your clipboard.Replace the existing variable with your new one.Select Save.JSON code for workflowSave this code sample to your computer, then follow the instructions in Set up workflow. Remember to turn on the workflow on when you're ready to begin using it.Reactivate on Message Create Workflow{ "description": "", "name": "requeue", "steps": [ { "transitions": [ { "target": "v1A1LJ-VT", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "yKVhLZnGE", "action": "kustomer.conversation.find-by-id", "params": { "id": "/#steps.1.id" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [], "errorCases": [], "id": "WAwwZTdZe", "action": "kustomer.conversation.update", "params": { "assignedUsers": [], "id": "/#steps.yKVhLZnGE.id" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "WAwwZTdZe", "condition": { "op": "eq", "values": [ "/#steps.v1A1LJ-VT.response.statusCode", "404" ] }, "meta": { "name": "Offline?" } } ], "errorCases": [], "id": "v1A1LJ-VT", "action": "kustomer.rest-api.generic", "params": { "uri": "https://***YOUR ORG HERE***.api.kustomerapp.com/v1/routing/users/{{steps.yKVhLZnGE.assignedUsers}}/work-sessions/current", "method": "GET", "headers": { "content-type": "application/json", "Authorization": "Bearer {{{variables.63728ea73c155fd97691173e}}}" }, "json": true }, "appVersion": "kustomer-^1.9.2", "meta": { "displayName": "Check User Work Session" } } ], "trigger": { "transitions": [ { "target": "yKVhLZnGE", "condition": { "op": "and", "values": [ { "op": "eq", "values": [ "/#steps.1.changes.attributes.status.before", "snoozed" ] }, { "op": "eq", "values": [ "/#steps.1.changes.attributes.status.after", "open" ] } ] }, "meta": { "name": "Re-opened" } } ], "eventName": "kustomer.conversation.update", "id": "1", "appVersion": "kustomer-^1.9.2" } }Filter specific conversation updates in a workflow
Workflows allow you to create a variety of automations throughout the Kustomer platform. You might want a workflow to run based on a specific conversation update, which can be useful when trying to prevent infinite looping workflows. Note: To prevent 'too many requests' errors from infinitely looping actions, it's important to filter workflows to run only on specific updates when using the following triggers: Customer Update, Conversation Update, Company Update and Message Update.In this article, we'll outline how to set up a workflow that only runs on conversations where a particular update occurred. Who can access this feature?User typesAdmins can access the Workflows page.In this articlePrerequisitesCreate the workflowBuild a filter conditionPrerequisitesTo work with this article, you will need to be familiar with creating workflows, and reading JSON data.To make it easier to read JSON responses, you might also consider installing a syntax highlighting browser extension like JSON Viewer.Create the workflowFirst, you'll create the workflow.Go to Settings and select Platform > Workflows.Select + Add Workflow.Choose Custom Workflow.Add a name and description that will help you and other admins identify this workflow in the future.Leave the callable workflow option off.Select Create. The workflow editor will open.Select the trigger step, and fill out the trigger information.Trigger app: KustomerTrigger event: Conversation UpdatedBuild a filter conditionNow that the workflow has been created, you will need to add a condition just below the trigger step. To determine the formatting of the condition, you can view the events endpoint on a conversation. This endpoint contains a complete history of all changes made to the specified conversation. Each event contains a list of all of the attributes that have changed, along with their old and new values. If you are ever uncertain about which attribute will be included in a change, make the change on a conversation and then view the event on the events endpoint.To access this endpoint, use the URL subdomain.api.kustomerapp.com/v1/conversation/id/events.The subdomain is the first part of your Kustomer URL that's unique to your organization. For example, if your Kustomer URL is acme-inc.kustomer.com, your subdomain would be acme-inc.The id is the ID of the conversation you would like to view.Here is an example of an event on the events endpoint:{ "type": "customer_event", "id": "63751d068a3cc92de23c6ab4", "attributes": { "name": "kustomer.conversation.update", "client": "api", "type": "conversation", "publishedAt": "2022-11-16T17:25:26.503Z", "createdAt": "2022-11-15T20:38:37.290Z", "updatedAt": "2022-11-16T17:25:26.481Z", "modifiedAt": "2022-11-16T17:25:26.481Z", ---> "changes": { "attributes": { "updatedAt": { "op": "replace", "before": "2022-11-15T20:38:39.466Z", "after": "2022-11-16T17:25:26.481Z" }, "modifiedAt": { "op": "replace", "before": "2022-11-15T20:38:37.360Z", "after": "2022-11-16T17:25:26.481Z" }, "tags": { "op": "replace", "before": [ ], "after": [ "614a0b7f3114d1b6c48b97df" ] }, "rev": { "op": "replace", "before": 4, "after": 5 } }, "relationships": { "modifiedBy": { "op": "replace", "before": { "links": { "self": "/v1/users/6373eb792b280f450f1d1b37" }, "data": { "type": "user", "id": "6373eb792b280f450f1d1b37" } }, "after": { "links": { "self": "/v1/users/614a0b776beb9a00191a6a9e" }, "data": { "type": "user", "id": "614a0b776beb9a00191a6a9e" } } } } } }, "relationships": { "org": { "links": { "self": "/v1/orgs/614a0b70c4b8b7071f3aab55" }, "data": { "type": "org", "id": "614a0b70c4b8b7071f3aab55" } }, "createdBy": { "links": { "self": "/v1/users/6373eb792b280f450f1d1b37" }, "data": { "type": "user", "id": "6373eb792b280f450f1d1b37" } }, "modifiedBy": { "links": { "self": "/v1/users/614a0b776beb9a00191a6a9e" }, "data": { "type": "user", "id": "614a0b776beb9a00191a6a9e" } }, "user": null, "customer": { "links": { "self": "/v1/customers/634efda657f97413db006a73" }, "data": { "type": "customer", "id": "634efda657f97413db006a73" } }, "conversation": { "links": { "self": "/v1/conversations/6373f8cdd3637b39d6af5301" }, "data": { "type": "conversation", "id": "6373f8cdd3637b39d6af5301" } } }, "links": { "self": "/v1/customers/634efda657f97413db006a73/events/63751d068a3cc92de23c6ab4" } }Changes made during an event can be found within the changes attribute, under attributes.In the above example, you'll see that a tag was added to the conversation with an id of 614a0b7f3114d1b6c48b97df, which is recorded under tags.To reference this change in a workflow, add the exact JSON path to the value, starting with the changes attribute: When creating this condition type, there are three things you can reference in general: A value before a change, a value after a change, or if a change occurred at all. The following examples demonstrate how to set up each of these types of conditions. In these examples, the changedAttribute section should be changed to the attribute/attribute path you'd like to reference.To reference the value before a change occurred, use /#steps.1.changes.attributes.changedAttribute.beforeTo reference the value after a change occurred, use /#steps.1.changes.attributes.changedAttribute.afterTo reference if a change occurred at all, use /#steps.1.changes.attributes.changedAttribute with the Exists and Does Not Exist qualifiers.Note: When referencing changes to queues, the format is slightly different: /#steps.1.changes.relationships.queue.before/after.data.idOnce the condition has been created, any workflow steps placed under the condition will only run if the specified change has happened on the conversation.Reroute conversations from the default queue
In Queues and Routing, your default queue acts as a catch-all for conversations that do not match any of your queue rules. It has a queue priority of 1 and cannot be edited or deleted.In some cases, automations — like business rules, workflows, or APIs — might run after a conversation has already been routed, and those automations are critical for the conversation landing in the right queue. In this scenario, you can use a workflow to clear the queue assignment on conversations that go to the default queue and requeue them.Who can access this feature?User typesAdmins and users with permissions to access workflows and API keys.In this articlePrerequisitesCreate an API keyCreate the workflowAdd the workflow JSONAdd the API key to the workflowCustomize the workflowPrerequisitesBefore following this guide, you should already be comfortable with the basics of using workflows. Workflows overviewWe also recommend being familiar with creating API keys and adding workflow variables.Create an API keyFirst, you'll need to set up the API key to use with the workflow.Create an API key.When setting up your new API key, assign it with the roles org.permission.conversation.update and org.user.conversation.write.Then, keep the token in a secure location to use later in this guide.Create the workflowNext, you'll set up the workflow to reroute conversations.Go to Settingsand select Platform > Workflows.Select Add Workflow > Custom Workflow.The New Workflow modal will appear. Fill out the Workflow Title. You can leave the Description field blank because the code snippet below will provide this for you.Leave the callable workflow option turned off.Select Create to save the workflow. You'll be taken to the Workflow Editor where the workflow can be customized.Add the workflow JSONThen, Use the Workflow Editor to paste in the workflow JSON code provided below. This JSON will take care of most of the workflow creation.In the Workflow Editor, open the Workflow Optionsmenu and select Edit Workflow JSON.A modal appears where you can edit the code for this workflow. Select and delete all the current JSON code.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": "reroute-conversations-from-default-queue", "steps": [ { "transitions": [ { "target": "6g9Dokv3y", "condition": { "op": "neq", "values": [ "/#steps.1.status", "done" ] }, "meta": { "name": "Conversation is Open or Snoozed" } } ], "errorCases": [], "id": "TSL_jNt24" }, { "transitions": [], "errorCases": [], "id": "6g9Dokv3y", "action": "kustomer.rest-api.json", "params": { "uri": "https://api.kustomerapp.com/v1/conversations/{{steps.1.id}}", "method": "PATCH", "data": { "queue": { "id": null }, "assignedUsers": [] }, "headers": { "Authorization": "Bearer", "Content-Type": "application/json" }, "json": true }, "meta": { "displayName": "Unset Queue to Reroute Conversation" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "TSL_jNt24", "condition": { "op": "dne", "values": [ "/#steps.1.assignedUsers.0", "" ] }, "meta": { "name": "Conversation is Unassigned" } } ], "errorCases": [], "id": "i6HWiIZeM" } ], "trigger": { "transitions": [ { "target": "i6HWiIZeM", "condition": { "op": "contains", "values": [ "/#steps.1.queue", null ] }, "meta": { "name": "Conversation Routed to Default Queue" } } ], "eventName": "kustomer.conversation.update", "id": "1", "appVersion": "kustomer-^1.9.2" } }The workflow will look like this:Add the API key to the workflowReopen the Workflow Optionsmenu and select Workflow Variables.Add the saved token from the API key you created earlier as a workflow variable. Name the workflow variable as desired and add the token in the Value field.Save the variable, select Close to exit the workflow editor, and save the updated workflow.Customize the workflowIn Step 4 of the workflow, select the key icon in the REST API JSON action step to access the workflow variable saved, and copy the workflow variable.Add a single space after Bearer in the Headers section, and paste the copied value which is the API token needed for authorization. Set the JSON (boolean) field to true.In the first condition called Conversation Routed to Default Queue, select the Default Queue as the queue that the conversation should be in.If there are any other changes to the workflow that you'd like to make, do so now. When you're finished, Save all and other workflow changes, and use the toggle to activate the workflow.Automatically close abandoned chats
Chat offers a quick and easy way for customers to get in touch with your support agents. Sometimes, customers may abandon a chat mid-conversation and stop responding to agents, which can negatively impact your Total Open Conversation times. You can use the volume control settings to close out conversations that get abandoned while a customer is interacting with a conversational assistant. This article outlines how to set up an automation that will automatically close out abandoned conversations that are assigned to an agent, and send a message to the customer letting them know their chat was ended due to inactivity. The workflow is triggered on an outbound message sent by an agent, and will only run on open conversations.Who can access this feature?User typesAdmins and users with permissions to access workflows and API keys.In this articleCreate an API keyCreate a callable workflowSet up the workflow variableCustomize the callable workflowCreate an initialization workflowCreate an API keyFirst, you'll need to create an API to use with these workflows.Create an API key.Name the API key to help you remember it will be associated with the Chat Auto Close workflow.When setting up your new API key, assign the roles org.permission.draft.create, org.user.draft.read, and org.user.draft.write.Then, keep the token in a secure location to use later in this guide.Create a callable workflowTo set up this automation, two workflows will need to be created:A callable workflow, andAn initialization workflow that schedules the callable workflow.Next, we'll set up the callable workflow.To create the first workflow:Go to Settings and select Platform > Workflows.Select Add Workflow, and choose Custom Workflow.Name the new workflow Chat Auto Close Pt 2, and add a description to help you remember what this workflow does in the future.Turn on the Callable Workflow toggle.Select Create. The workflow editor will open.Open the Workflow Options menu in the toolbar and select Edit Workflow JSON.A modal appears where you can edit the code for this workflow. Select and delete all the current JSON code.Copy the below code block, and paste it into the JSON text field in your Workflow Editor.If your instance is hosted on our EU server, click on the Send a Message workflow step and replace what is in the URI field with https://api.prod2.kustomerapp.com.Then, select Update to save the changes to the workflow and dismiss the JSON editor.{ "description": "", "name": "chat-auto-close-pt-2", "steps": [ { "transitions": [ { "target": "zStY5mfO2", "condition": { "op": "true", "values": [ true ] }, "meta": { "name": "No New Messages" } } ], "errorCases": [], "id": "Qz3ioLdLD" }, { "transitions": [ { "target": "ryBHW-SFD", "condition": { "op": "true", "values": [ true ] }, "meta": { "name": "Conversation is Still Open" } } ], "errorCases": [], "id": "zStY5mfO2" }, { "transitions": [ { "target": "ON2ifnbPX", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "ryBHW-SFD", "action": "kustomer.conversation.update", "params": { "id": "/#steps.1.conversationId", "status": "done" }, "appVersion": "kustomer-^1.9.2", "meta": { "displayName": "Close the Conversation" } }, { "transitions": [], "errorCases": [], "id": "ON2ifnbPX", "action": "kustomer.rest-api.json", "params": { "uri": "https://api.kustomerapp.com/v1/customers/{{steps.eK7TtTl6J.customer}}/drafts", "method": "POST", "data": { "auto": true, "sendAt": "{{{date 'day' count=0}}}", "conversation": "/#steps.eK7TtTl6J.id", "body": "INSERT BODY HERE", "channel": "chat" }, "headers": { "Authorization": "Bearer INSERT KEY HERE", "Content-Type": "application/json" } }, "appVersion": "kustomer-^1.9.2", "meta": { "displayName": "Send a Message" } }, { "transitions": [ { "target": "Qz3ioLdLD", "condition": { "op": "eq", "values": [ "/#steps.1.messageCount", "/#steps.eK7TtTl6J.messageCount" ] }, "meta": { "name": "Still same inbound/outbound message" } } ], "errorCases": [], "id": "eK7TtTl6J", "action": "kustomer.conversation.find-by-id", "params": { "id": "/#steps.1.conversationId" }, "appVersion": "kustomer-^1.9.2" } ], "trigger": { "transitions": [ { "target": "eK7TtTl6J", "condition": { "op": "true", "values": [ true ] } } ], "id": "1", "callable": true, "schema": { "properties": { "conversationId": { "type": "string" }, "messageCount": { "type": "string" } }, "required": [ "conversationId", "messageCount" ] }, "eventName": "kustomer.workflow.637552f101c4e5801f2f45d9.call" } }Set up the workflow variableNow you'll add the API key created earlier to the callable workflow using a workflow variable. Workflow variables allow you to store API keys securely and access them from within your workflow.To set up the workflow variable:Open the Workflow Options menu in the toolbar and select Workflow Variables.Give the variable a name, and paste the API key created earlier in the Value field, and select Save.Select the Send a Message workflow step.Scroll down to the Headers section, and select the Variables key icon.Select the variable you just created.Delete the INSERT KEY HERE text, and replace it with the copied workflow variable.Save your changes.Customize the callable workflowNext, you'll edit the body of the message that gets sent to customers and add any attributes that would be required to mark the conversation done.In the workflow editor, select the Send a Message workflow step and scroll down to the Data field.In the code block, remove the INSERT BODY HERE text and replace it with your preferred messaging. Make sure your entire message remains within quotation marks.If you have any attributes that are required to mark a conversation done, select the Close the Conversation step and fill in the blank attributes under Required Fields.Save your workflow.Note: To add a line break between any two sentences in the body, add \r\n\r\n between them.Create an initialization workflowWith the callable workflow created and customized, you will now need to create a workflow that schedules the callable workflow.To create the second workflow:Go to Settings and select Platform > Workflows.Select Add Workflow, and choose Custom Workflow.Name the new workflow Chat Auto Close Pt 1, and add a description to help you remember what this workflow does in the future.Leave off the Callable Workflow toggle.Select Create. The workflow editor will open.Open the Workflow Options menu in the toolbar and select Edit Workflow JSON.A modal appears where you can edit the code for this workflow. Select and delete all the current JSON code.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.Select the final step in the workflow, and use the drop-down menu to select Chat Auto Close Pt 2 under Workflow Title.Set a timer to however long you want to wait before chats are automatically closed. The default setting is 5 minutes.{ "description": "", "name": "chat-auto-close-pt-1", "steps": [ { "transitions": [ { "target": "CKFeO2SgM", "condition": { "op": "eq", "values": [ "/#steps.ZhrZRw_EH.status", "open" ] }, "meta": { "name": "Conversation is Open" } } ], "errorCases": [], "id": "ZhrZRw_EH", "action": "kustomer.conversation.find-by-id", "params": { "id": "/#steps.1.conversation" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "-MsOdSJrY", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "CKFeO2SgM" }, { "transitions": [ { "target": "SC5a5GJIP", "condition": { "op": "eq", "values": [ "/#steps.-MsOdSJrY.userType", "user" ] }, "meta": { "name": "Skip over messages with the Assistant" } } ], "errorCases": [], "id": "-MsOdSJrY", "action": "kustomer.user.find-by-id", "params": { "id": "/#steps.ZhrZRw_EH.assignedUsers" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "fQBPmRRRD", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "SC5a5GJIP" }, { "transitions": [ { "target": "WqsaGso0t", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "fQBPmRRRD" }, { "transitions": [], "errorCases": [], "id": "WqsaGso0t", "action": "kustomer.app.scheduler.schedule-workflow", "params": { "runAt": { "value": 300, "type": "relative" }, "workflowId": "637552f101c4e5801f2f45d9", "inputs": { "conversationId": "/#steps.1.conversation", "messageCount": "/#steps.ZhrZRw_EH.messageCount" } }, "appVersion": "scheduler-^1.0.1" } ], "trigger": { "transitions": [ { "target": "ZhrZRw_EH", "condition": { "op": "and", "values": [ { "op": "eq", "values": [ "/#steps.1.direction", "out" ] }, { "op": "eq", "values": [ "/#steps.1.channel", "chat" ] } ] }, "meta": { "name": "Outbound Chat Message Only" } } ], "eventName": "kustomer.message.create", "id": "1", "appVersion": "kustomer-^1.9.2" } }Now that both workflows have been created and saved, toggle on both workflows in the Workflows settings to begin automatically closing abandoned chats.Create a snooze status from a workflow
Workflows can be used to set statuses on conversations automatically. Snooze is a unique status in that it takes a few extra steps to update via a workflow because you'll need to update the snooze attribute along with the status attribute.To update the snooze attribute in a workflow, set the Snooze field to Scheduled in the workflow editor. After selecting this value, you'll find an option to set the length of the snooze in relative minutes.You can also turn on the JSON toggle to have the Snooze attribute accept JSON data. With this method, you can build a custom time attribute to allow for more granular results, like specifying the snooze time for a specific day and time instead of using relative time.Track merged conversations
If your users are assigned to a permission set that allows them to merge or combine separate conversations into one, you may be interested in tracking these conversation merges for reporting or data analysis. You can use a workflow to perform this automated task.Who can access this feature?User typesAdmins can access the Workflows and API Keys pages.In this articlePrerequisitesCreate an API keyCreate the workflowAdd the workflow JSONAdd the API key to the workflowCustomize the workflowPrerequisitesBefore following this guide, you should already be comfortable with the basics of using workflows. Workflows overviewWe also recommend being familiar with creating API keys and adding workflow variables.Create an API keyFirst, you'll need to set up the API key to use with the workflow.Create an API key.When setting up your new API key, assign it with the roles org.user.conversation.read and org.permission.conversation.read.Then, keep the token in a secure location to use later in this guide.Create the workflowNext, you'll set up the workflow to assign conversations.Go to Settingsand select Platform > Workflows.Select Add Workflow > Custom Workflow.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.Leave the callable workflow option turned off.Select Create to save the workflow. You'll be taken to the Workflow Editor where the workflow can be customized.Add the workflow JSONThen, Use the Workflow Editor to paste in the workflow JSON code provided below. This JSON will take care of most of the workflow creation.In the Workflow Editor, open the Workflow Optionsmenu and select Edit Workflow JSON.A modal appears where you can edit the code for this workflow. Select and delete all the current JSON code.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": "track-and-add-note-on-merged-conversations", "steps": [ { "transitions": [ { "target": "pEDKbR89t", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "AEPHnMx4d", "action": "kustomer.regex-match.generic", "params": { "testString": "/#steps.-4j4buTAQ.response.body.data.links.related", "regex": "\\/v1\\/conversations\\/(.*)" }, "meta": { "displayName": "Get Target Conversation's ID" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "JlLkAL2-B", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "pEDKbR89t" }, { "transitions": [ { "target": "iBNOl5EXz", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "JlLkAL2-B", "action": "kustomer.user.find-by-id", "appVersion": "kustomer-^1.9.2", "params": { "id": "/#steps.1.modifiedBy" }, "meta": { "displayName": "Find User who Merged the Conversations" } }, { "transitions": [], "errorCases": [], "id": "iBNOl5EXz", "action": "kustomer.note.create", "params": { "conversation": "/#steps.AEPHnMx4d.captures", "body": "Conversation {{{steps.1.id}}} has been merged to this conversation by **{{{steps.JlLkAL2-B.name}}}**." }, "meta": { "displayName": "Create Merge Note on Target Conversation" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "AEPHnMx4d", "condition": { "op": "and", "values": [ { "op": "exists", "values": [ "/#steps.-4j4buTAQ.response.body.data.links.related", "" ] }, { "op": "neq", "values": [ "/#steps.-4j4buTAQ.response.body.data.links.related", "null" ] } ] }, "meta": { "name": "Parent / Target Conversation Exists" } } ], "errorCases": [], "id": "-4j4buTAQ", "action": "kustomer.rest-api.json", "params": { "uri": "https://api.kustomerapp.com/v1/conversations/{{{steps.1.id}}}", "method": "GET", "headers": { "Authorization": "Bearer", "Content-Type": "application/json" }, "json": true }, "meta": { "displayName": "Get Merged (Soft-Deleted) Conversation's Data" }, "appVersion": "kustomer-^1.9.2" } ], "trigger": { "transitions": [ { "target": "-4j4buTAQ", "condition": { "op": "eq", "values": [ "/#steps.1.changes.attributes.deleted.after", "true" ] }, "meta": { "name": "Is Merged (Soft-Deleted)" } } ], "eventName": "kustomer.conversation.update", "id": "1", "appVersion": "kustomer-^1.9.2" } }The workflow will look like this:Add the API key to the workflowReopen the Workflow Optionsmenu and select Workflow Variables.Add the saved token from the API key you created earlier as a workflow variable. Name the workflow variable as desired and add the token in the Value field.Save the variable, select Close to exit the workflow editor, and save the updated workflow.Customize the workflowIn Step 2 of the workflow, select the key icon in the REST API JSON action step to access the workflow variable saved, and copy the workflow variable. Add a single space after Bearer in the Headers section, and paste the copied value which is the API token needed for authorization. Set the JSON (boolean) field to true.In the same step (Step 2), go to Uri (string) field and add your your Kustomer subdomain before .api to complete the API endpoint. For example, if your Kustomer URL is acme-inc.kustomer.com, your Uri (string) would begin with https://acme-inc.api.kustomerapp.If there are any other changes to the workflow that you'd like to make, do so now. When you're finished, Save all and other workflow changes, and use the toggle to activate the workflow.Automatically reopen outbound voice calls
Integrating voice channels is a very common way to take advantage of Kustomer's omnichannel capabilities. You can use workflow automation to overwrite voice channel default behaviors, like whether or not a call is automatically marked as done when completed. In this article, we'll show you how to set up a workflow that reopens outbound voice calls after completion so they remain in the queue.Who can access this feature?User typesAdmins can access the Workflows and API Keys pages.In this articlePrerequisitesOverviewCreate a workflowCustomize the workflowPrerequisitesBefore following this guide, you should already be comfortable with the basics of using workflows. Workflows overviewYou will also need to have your voice channel already set up before starting this guide.OverviewVoice integrations work by updating the message based on several events send from your voice provider. You can use a workflow to set conditions to target events for outbound calls and reopen the conversation. By default, voice channels will close a conversation when an outbound call is completed — but depending on your organization's needs, you might prefer a voice conversation to remain open afterward. This article will guide you through creating a workflow to make this change for all outbound voice calls.Create a workflowGo to Settingsand select Platform > Workflows.Select Add Workflow > Custom Workflow. The New Workflow modal will appear.Fill out a name and description for your workflow. As a best practice, we always recommend using clear, descriptive titles to help you and the rest of your admin team remember how this automation will be used in the future.Leave the callable workflow option turned off.Select Create to save the workflow. You'll be taken to the Workflow Editor where the workflow can be customized.Customize the workflowNext, you'll use the Workflow Editor to set up the workflow.Select the first step. In the right panel, set the trigger to:Trigger App: KustomerTrigger Event: Message UpdatedAdd a Condition Step and give it the name Outbound Voice. For this step, you'll set up 2 conditions, with the operator Multiple Conditions (And). These conditions will be pulled from the Message Updated data output in the trigger step.Condition 1: Direction Type > Equals > Initial OutCondition 2: Channel > Equals > VoiceNext, add another condition step which will check for an event change. This Call related update will have 1 condition. Paste in the code /#steps.1.changes.attributes.meta.after.status, and set it to Exists. Use the Toggle Code View option as needed to enter or edit the code. Add an action step to look up the conversation from step 1.Action App: KustomerAction Event: Conversation: Lookup (By ID)Identifier (string): /#steps.1.conversationAdd a new condition that references step (3) Conversation: Lookup (By ID) and that checks that the conversation Status > Equals > Done.Finally, add a new action step with the following characteristics:Action App: KustomerAction Event: Conversation UpdateId (string): (1) Message Updated > ConversationStatus (string): openEnded (boolean): falseWith that last step, your workflow will be finished and is ready to be activated. Be sure to use the Save button to preserve your changes. The final workflow should look like the screenshot below.Manage and reroute customer-ended chats
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 articlePrerequisitesOverviewCreate the workflowAdd the workflow JSONCustomize the workflowPrerequisitesBefore following this guide, you should already be comfortable with the basics of using workflows. Workflows overviewOverviewWhen 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 workflowFirst, you'll set up the workflow to assign conversations.Go to Settings> Platform > Workflows.Select Add Workflow > Custom Workflow.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.Leave the callable workflow option turned off.Select Create to save the workflow. You'll be taken to the Workflow Editor where the workflow can be customized.Add the workflow JSONNext, use the Workflow Editor to paste in the workflow JSON code provided below. This JSON will take care of most of the workflow creation.In the Workflow Editor, open the Workflow Optionsmenu and select Edit Workflow JSON.A modal appears where you can edit the code for this workflow. Select and delete all the current JSON code.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 workflowLast, 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.Start a conversational assistant on an open chat
Conversational assistants are a powerful tool that promote customer self-service, boost agent productivity, and speed up response times.On rare occasion, a chat customer might experience a network issue or reach out using an outdated link which could cause the conversational assistant to be skipped. In this article, we'll discuss how to set up a workflow automation that allows agents to apply a tag to a conversation to retroactively start an assistant. This will allow conversations under these circumstances to be given the same support experience as normal chat messages.Who can access this feature?User typesAdmins and users with permissions to access workflows.In this articlePrerequisitesCopy the assistant IDCopy the tag IDCreate the workflowCustomize the workflowPrerequisitesBefore following this guide, you should already be comfortable with the basics of using workflows. Workflows overviewWe also recommend being familiar with creating and using conversational assistants.For this process, you must have already created the conversational assistant, which you will modify during this guide.Copy the assistant IDFirst, you'll use the Kustomer settings to find the conversational assistant's public ID.To locate the assistant ID:Go to Settings and select Kustomer IQ > Conversational Assistants.Locate the desired assistant.Select to copy the assistant ID to your clipboard.Save the assistant public ID to a secure location so you can access it later in this guide.Copy the tag IDNext, you'll find the ID for the tag you want to use to trigger the workflow. Agents will add this tag to a conversation to start the assistant, so we recommend setting up a tag with an easily understood name like Launch Assistant.To locate the tag ID:Go to Settings and select Workspace > Tags.Locate the desired tag and select Edit .Look at the URL in your browser's address bar. The tag ID is the alphanumeric code after /tags/edit/.Copy the tag’s ID from the end of the URL, and save it to a secure location so you can access it later in this guide.Create the workflowThen, create the workflow using the provided template, which should set up most of the automation.To create the workflow:Go to Settings and select Platform > Workflows.Select + Add Workflow.Select Custom Workflow.Fill out the Name and Description of this workflow. We always recommend as a best practice that you use clear and illustrative names and descriptions, so that it's easy to know what function this automation performs if another member of your team reviews this rule at a later date.Leave Callable Workflow off and then select Create.Open the Workflow Options menu in the toolbar and select Edit Workflow JSON.A modal appears where you can edit the code for this workflow. Select and delete all the current JSON code.Copy the code block below 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": "launch-assistant", "steps": [ { "transitions": [], "errorCases": [], "id": "UN5BKgSYD", "action": "kustomer.assistant.launch", "params": { "publicId": "", "messageId": "/#steps.1.lastMessageIn.id", "conversationId": "/#steps.1.id" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "QEt_FXrHX", "condition": { "op": "and", "values": [ { "op": "eq", "values": [ "/#steps.1.lastMessageDirection", "in" ] }, { "op": "eq", "values": [ "/#steps.1.messageCount", "1" ] } ] }, "meta": { "name": "Initial-Inbound Message" } } ], "errorCases": [], "id": "LiLssS9QM" }, { "transitions": [ { "target": "UN5BKgSYD", "condition": { "op": "contains", "values": [ "/#steps.1.changes.attributes.tags.after", "" ] }, "meta": { "name": "Tag added" } } ], "errorCases": [], "id": "QEt_FXrHX" } ], "trigger": { "transitions": [ { "target": "LiLssS9QM", "condition": { "op": "contains", "values": [ "/#steps.1.channels", "chat" ] }, "meta": { "name": "Continue if chat" } } ], "eventName": "kustomer.conversation.update", "id": "1", "appVersion": "kustomer-^1.9.2" } }Customize the workflowAs the last step, you will customize the workflow created from the JSON template.To customize the workflow:In the conditional step Tag added, add the tag ID you found earlier as the condition value.In action step 4 Assistant Launch, add the assistant public ID you found earlier in the PublicId (string) field.Save your workflow and turn it on.Agents will now be able to add the conversation tag Launch Assistant to any chat with no assistant containing 1 inbound message from a customer. This will launch the conversational assistant and allow the customer to go through the standard prompts in that assistant.Customize app-created workflows
Many Kustomer app integrations come with preconfigured app-created workflows that help the integration function. If you need additional functionality beyond the out-of-the-box features of these app-created workflows, there are a few ways to make further customizations to meet the needs of your business.Who can access this feature?User typesAdmins can access the Workflows page.In this articleFind app-created workflowsRecommended: parallel customizationsAlternative method: branching the workflowFind app-created workflowsWorkflows created by apps can be located in a dedicated tab in the Workflows settings.Go to Settings and select Platform > Workflows.Select the App Created tab.Recommended: parallel customizationsApp-created workflows cannot be directly edited because they are created and maintained through app updates. This means that any new updates to the workflow will be automatically pushed out when the app has any updates or new features added.The recommended method for making customizations to an app-created workflow would be to create a new workflow that runs alongside the original workflow. This method has a few benefits:Keeping your desired customizations in their own workflow makes it easier to manage and update your custom workflow whenever needed without interrupting the overall functionality of the app-created workflow.Leaving the original app-created workflow on allows it to automatically receive updates and new features alongside updates that are made available in the App Directory.Alternative method: branching the workflowAlternatively, you can create a copy of the original app-created workflow to make changes to it, and turn off the original app-created workflow. This method is not recommended for most organizations, because it comes with some important drawbacks:DrawbacksBy turning off the original workflow, your branched integration will not receive any fixes or improvements alongside app updates. Any updates or changes made available to the app — and subsequent changes to the app-created workflow — will not be applied to your workflow branch.App-created workflows aren't directly editable because they are created and maintained through app updates. Since your branched workflow won't receive updates, any updates to the app integration may disrupt the branched workflow's ability to work properly.This method makes it more difficult to maintain your integration in the long term alongside app updates.If you understand these caveats and still wish to pursue this method, here's how to duplicate an app-created workflow.Find the desired workflow in the App Created list.Open the More Options menu.Select Duplicate.The duplicated workflow will be saved to the User Created tab. Navigate to the new workflow and press Edit to make changes to it.Tag Facebook and Instagram conversations with brand
Many organizations have multiple brands with an online presence that spans multiple social media pages. Kustomer's Facebook and Instagram integrations can pull conversations from multiple social media accounts into your unified timeline. You might still find it useful to see which conversation came from which brand's social account.Conversations already show which channel they come in on, but you can use workflows to take this a step further and use tags to add more visibility on where the conversation originated from. In this article, we'll set up a workflow to mark conversations with a tag that indicates which Facebook or Instagram page the conversation came from.Note: This workflow and tutorial can only be applied to Facebook and Instagram channels.Who can access this feature?User typesAdmins and users with permissions to create workflows and access app settings.Plan availability✘ Professional✔ Business✔ Enterprise✔ UltimateThe features included in each subscription package are at all times governed by the subscription description on our website or in your contract. Always refer to our Application limits article for the most up-to-date subscription package definitions and plan limits for this feature.In this articleFind your social media page IDCreate tagSet up workflowFind your social media page IDTo find your social media page ID:Go to Apps and select Facebook or Instagram.View the page you would like to add a tag for.Copy the Page ID and save it somewhere accessible so you can refer to it later in this guide.Create tagTo create the tag:Go to Settingsand select Workspace > Tags.Select Add Tag.Fill in the Name and select a color for the tag.Select Create.Note: We recommend repeating this process to create a unique tag for each social media page you will add to the workflow. As a best practice, the tag should use the same name as the corresponding social page.Set up workflowTo create the workflow:Go to Settingsand select Platform > Workflows.Select Add Workflow.Select Custom Workflow.Give the workflow a Title and Description to help your admin team remember what function this automation performs in the future.Change the first step Trigger App to Kustomer and the Trigger Event to Conversation Created.Add an Action step for a Conversation: Lookup (By ID) using the conversation ID from from Step 1 (Conversation Created).Add a Condition Step with Multiple Conditions (Or) to filter for conversations with only social media channels.Note: Add all channels for both Facebook and Instagram.Add a Condition Step, followed by a Condition Branch for each social media page you want to track.For each branch, add a Condition Step with the following JSON in the Select field, and set it Equals to the social media page ID you located earlier:/#steps.***STEP 2 ID***.firstMessageIn.meta.toFinally, add an Action Step for a Conversation: Add Tags step to tag the conversation with the tag you created earlier that corresponds to the social media page.With the workflow finished, you're all set to turn it on and test it out. Try turning on the workflow, then opening View Logs while you send in a test conversation from one of your social media pages to confirm everything works as expected.This tutorial was built using tags to match to the social media page, but could just as easily be altered to use a custom conversation attribute instead. Either option will offer a bit more insight into which social media page conversations come from, and give you the ability to set up additional automations or use the tags or custom attribute for reporting purposes.Call a REST API within a workflow
Workflows allow you to access Rest APIs in a flexible way to connect to other systems. For example, when a customer’s contact information is updated within Kustomer, you may want to sync that data with your organization’s internal admin tool. Alternatively, when a message comes into Kustomer, you may want to send the text to a system that can detect your customer’s intent and tag the conversation to ensure the correct user or team handles it. If Kustomer does not yet have a direct integration with the tools you use, REST API calls in Workflows are a great way to customize Kustomer to suit your needs.Who can access this feature?User typesAdmins can access workflows and API pages.In this articleAccess workflowsCreate a new workflowJSON vs. generic REST API actionConfigure the actionUse the REST API responseFAQAccess workflowsUsers with admin permissions can access the Workflows settings by going to Settings > Platform > Workflows.Create a new workflowCreate a new workflow or edit an existing one in the Workflows settings.Making REST API calls from Workflow starts in the Workflow editor:After defining when the workflow should run and adding the workflow’s trigger and conditions, create a new action. Select Kustomer from the Action App drop-down menu in the right panel. JSON vs. generic REST API actionFrom here, you have two options in the Action Event menu that can be used to make REST API calls:REST API: JSON—This is the most common request when making an API call to a server that accepts JSON-formatted requests.REST API: Generic - If the server receiving your request requires a different format, this action allows you to customize the request body as a text string. Configure the actionThe following fields are available in both actions:URIThe request's full address should be sent to includes the protocol and path. Example: https://api.kustomerapp.com/v1/customersMethodThe HTTP method of the request.Example: POST, GET, PUT, PATCH, or DELETEDataThe value of this field will vary depending on the action selected. REST API: JSON: This will be a JSON object. Kustomer workflow syntax can be used in the nested values of the JSON to insert dynamic values into the payload.Example: { "customerId": "/#steps.1.id" }REST API: Generic: This will be a string. Handlebars can be used to insert dynamic values into the payload.Example: { "customerId": "{{steps.1.id}}" }HeadersA JSON object with key-value pairs of the HTTP headers that should be sent with the request.Example: { "content-type": "application/json" }JSONif this field is set to true, Kustomer will attempt to parse the response as JSON. Use the REST API responseAfter using either of the REST API Actions, you may want to access the response from those calls in the rest of your workflow. Kustomer exposes two properties that you can use:ResponseThe response contains metadata about the response to your API request. It will include the status code, content type, content length, and other details.Body The body of the response, if you specified that the body should be parsed as JSON, then you can also select specific elements that are returned in the response. To understand the response format, use the Workflow Logger to see the exact data available for use in further steps.For example, for a JSON response that looks like { "externalId": "1234" }, you can access the data using the following syntax:/#steps.[step-id].body.externalId FAQQ: I want to include the raw data output from the trigger or from one of the workflow's steps in my API request. How do I do this without re-building the data structure one field at a time?A: There's no need to rebuild the entire JSON structure in the API request body. You can use a step's output by referencing the step's ID. Here's an example for using the trigger step's data in a request body:Q: I'm seeing errors in the REST API step while debugging my workflow. What do these errors mean?Errors within a workflow’s Rest API step are indicative that the API call made as a result of a workflow action step failed. When debugging, the input represents the exact call that was made, and can be checked against the Kustomer API Reference guide to ensure the call is structured correctly. The output will show the response of the call, and a statusCode will be present in that data. More information on each status code can be found in Kustomer API Reference: Errors, which can assist with troubleshooting common issues.Q: My REST API workflow step ran as expected, but my data did not update correctly. What happened?After a REST API call runs, the status code might show a 200 response if the data does not update as expected. This indicates that while nothing was wrong with the call itself, there was an issue with something the call was trying to do. Review the workflow debug logs to see the input on how the API call ran, and check to ensure all of the expected data was present when that step ran.Manage Instagram story mentions using a workflow
Instagram stories allow users to post photos or videos that automatically disappear within 24 hours. This feature includes the @mention option, which allows someone to mention or tag your Instagram Professional account in a story.If you have Instagram integrated in your instance, these story mentions will be created as Instagram direct messages (IG DMs). You may want to process mentions differently from other types of direct messages.For this, you can use a workflow to manage story mentions.Who can access this feature?User typesAdmins can access the Workflows page.In this article:PrerequisitesCreate the workflowEnter the workflow JSON codeCustomize the workflowPrerequisitesBefore following this guide, we recommend that you are comfortable with the basics of using workflows. See Workflows Overview for more information.Create the workflowYou can create custom workflows from the Kustomer app.To create a workflow:Go to Settings> Platform > Workflows.Select Add Workflow > Custom Workflow. The New Workflow window opens.Enter a Workflow Title and add your own description for the workflow in the Description field.Select Create to save the workflow and begin working in the Workflow Editor.Enter the workflow JSON codeUse the Workflow Editor to paste in the workflow code supplied below. This JSON code will identify story mention messages and allow you to update the conversations those messages are created in.1. In the Workflow Editor, use the Workflow Optionsto select Edit Workflow JSON.2. A window opens where you can edit the code for this workflow directly. 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 dismiss the JSON editor and save the changes to the workflow.{ "description": "", "name": "instagram-story-mentions", "steps": [ { "transitions": [ { "target": "YL7tWDGA3", "condition": { "op": "contains", "values": [ "/#steps.1.meta.messageType", "storyMention" ] }, "meta": { "name": "Is a Story Mention" } } ], "errorCases": [], "id": "85csR397j" }, { "transitions": [ { "target": "oLHIQR1F7", "condition": { "op": "exists", "values": [ "/#steps.YL7tWDGA3.id", "" ] }, "meta": { "name": "Conversation Found" } } ], "errorCases": [], "id": "YL7tWDGA3", "action": "kustomer.conversation.find-by-id", "params": { "id": "/#steps.1.conversation" }, "meta": { "displayName": "Find Conversation" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [], "errorCases": [], "id": "oLHIQR1F7", "action": "kustomer.conversation.update", "params": { "id": "/#steps.YL7tWDGA3.id" }, "meta": { "displayName": "Update Conversation" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "85csR397j", "condition": { "op": "eq", "values": [ "/#steps.1.channel", "instagram" ] }, "meta": { "name": "Is an Instagram Message" } } ], "errorCases": [], "id": "scM9jq52e" } ], "trigger": { "transitions": [ { "target": "scM9jq52e", "condition": { "op": "eq", "values": [ "/#steps.1.direction", "in" ] }, "meta": { "name": "Is an Inbound Message" } } ], "eventName": "kustomer.message.create", "id": "1", "appVersion": "kustomer-^1.9.2" } }The workflow will look like the image below.Customize the workflowYou can add the changes you'd want the workflow to make on the conversation in the Update Conversation step. You can also change this step if you want to update the message or another object instead.When you're finished, Save all and other workflow changes, and turn the workflow on using the togglethe toggle to activate the workflow.Manage Instagram story replies using a workflow
Instagram stories allow you to post photos or videos that automatically disappear within 24 hours. This feature includes the Reply option, which allows users to reply to your stories.If you have Instagram integrated in your instance, these story replies will be created as Instagram direct messages (IG DMs). You may want to process story replies differently from other types of direct messages.For this, you can use a workflow to manage story replies.Who can access this feature?User typesAdmins can access the Workflows page.In this article:PrerequisitesCreate the workflowEnter the Workflow JSON codeCustomize the workflowPrerequisitesBefore following this guide, we recommend that you already be comfortable with the basics of using workflows. See Workflows Overview for more information.Create the WorkflowYou can create custom workflows from the Kustomer app.To create a workflow:Go to Settingsand select Platform > Workflows.Select Add Workflow > Custom Workflow. The New Workflow window opens.Enter a Workflow Title and add your own description for the workflow in the Description field.Select Create to save the workflow and begin working in the Workflow Editor.Enter the Workflow JSON codeUse the Workflow Editor to paste in the workflow code supplied below. This JSON code will identify Story Reply messages and allow you to update the conversations those messages are created in.In the Workflow Editor, go to Workflow Optionsand select Edit Workflow JSON.A window opens where you can edit the code for this workflow directly. Select and delete all the current JSON code.Copy the code block below, and paste it into the JSON text field in your Workflow Editor. Then, select Update to dismiss the JSON editor and save the changes to the workflow.{ "description": "", "name": "instagram-story-replies", "steps": [ { "transitions": [ { "target": "YL7tWDGA3", "condition": { "op": "contains", "values": [ "/#steps.1.meta.messageType", "storyReply" ] }, "meta": { "name": "Is a Story Reply" } } ], "errorCases": [], "id": "85csR397j" }, { "transitions": [ { "target": "oLHIQR1F7", "condition": { "op": "exists", "values": [ "/#steps.YL7tWDGA3.id", "" ] }, "meta": { "name": "Conversation Found" } } ], "errorCases": [], "id": "YL7tWDGA3", "action": "kustomer.conversation.find-by-id", "params": { "id": "/#steps.1.conversation" }, "meta": { "displayName": "Find Conversation" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [], "errorCases": [], "id": "oLHIQR1F7", "action": "kustomer.conversation.update", "params": { "id": "/#steps.YL7tWDGA3.id" }, "meta": { "displayName": "Update Conversation" }, "appVersion": "kustomer-^1.9.2" }, { "transitions": [ { "target": "85csR397j", "condition": { "op": "eq", "values": [ "/#steps.1.channel", "instagram" ] }, "meta": { "name": "Is an Instagram Message" } } ], "errorCases": [], "id": "scM9jq52e" } ], "trigger": { "transitions": [ { "target": "scM9jq52e", "condition": { "op": "eq", "values": [ "/#steps.1.direction", "in" ] }, "meta": { "name": "Is an Inbound Message" } } ], "eventName": "kustomer.message.create", "id": "1", "appVersion": "kustomer-^1.9.2" } }The workflow will look like the image below.Customize the workflowYou can add the changes you'd want the workflow to make on the conversation the Update Conversation step. You can also change this step if you want to update the message or another object instead.When you're finished, Save all and other workflow changes, and use the toggle to activate the workflow.Improve workflow readability with line breaks
You can create a better experience for your agents by adding line breaks to strings inside of workflows. Adding line breaks makes it easier to parse longer strings and help agents quickly find relevant details.Who can access this feature?User typesAdmins can access the Workflows page.In this articleWhy use line breaks?Add line breaks to workflow JSONWhy use line breaks?Line breaks help you improve the legibility of code blocks by making it easier to find relevant details within workflow syntax. As a best practice, we recommend adding line breaks anytime you display data to a user from a string attribute.For example, if your workflow ingests a form hook and creates a message from the data in the payload, you can use line breaks to turn a long paragraph of items into an easier-to-read list.Add line breaks to workflow JSONA line break can be created by inserting \n into the JSON for the workflow. To do this, you must first create the action that will hold the string attribute. For example, you can the Body (string) attribute from a Message: Create workflow action.To add a line break:In the workflow editor, select the desired workflow action you'd like to update.Add input to the desired attribute without any line breaks.Give the workflow action a distinct, identifiable name by editing the text field above Action Information on the right panel.Open the Workflow Options menu and select Edit Workflow JSON.Use CTRL+F or CMD+F to open the text search bar, and enter the action name specified in step 3.Scroll the Parameters section directly above or below the "meta": { "displayName": "Action Name" } code that was found in your search.Find the attribute that corresponds to the input you specified earlier.Add \n wherever you'd like to insert a line break.Select the Update button on the bottom right corner.When you're satisfied with these changes, be sure to Save the workflow.The desired attribute input will now contain line breaks.Note: Any updates to attributes containing line breaks using the workflow editor will strip out manually-added line breaks. If you make other changes in the inspector panel, it will override these manual styling updates, and you will need to add the line break in the workflow JSON again.Connect custom attributes and reports with workflows
Kustomer comes pre-loaded with standard objects and attributes which are used in reporting and filtering data. However, most businesses need to add custom data from external sources in order to report on metrics more unique to their business.You can use workflows and custom attributes to move data from one area of Kustomer to another in order to use specific metrics wherever they're needed. In this tutorial, you'll learn how to set up a workflow that brings in custom attribute data, and then build a custom report around this data.Who can access this feature?User typesAdmins can access workflows, attribute settings, and reporting.In this articlePrerequisitesCreate the custom attributeCreate the workflowCustomize the workflowCreate the custom reportPrerequisitesBefore following this guide, you should already be comfortable with the basics of using workflows. Workflows overviewWe also recommend being familiar with Custom attributes and Custom reporting.Create the custom attributeFirst, you'll create the attribute on the desired Klass. For the purposes of this tutorial, the attribute will be created on the Message Klass to track the queue the conversation was in when a message was sent.Go to Settings > Platform > Klasses.Select the Klass you want the attribute to be on. If you're following the tutorial example, select the Message Klass.Select Create Attribute.Create a new attribute with the following properties:Name: QueueType: Single line textSingle ValueCreate the workflowNext, you'll create a workflow that will trigger when a new message is created which adds the conversation's queue at that time to the message object.Go to Settings > Platform > Workflows.Select Add Workflow > Custom Workflow.Fill in a name and description for your workflow. If you're following the tutorial example, name it Add Message Queue. As a best practice, we always recommend using clear, descriptive titles to help you and the rest of your admin team remember how this automation will be used in the future.Leave the callable workflow option turned off.Select Create to save the workflow. You'll be taken to the Workflow Editor where the workflow can be customized.Customize the workflowSelect the first step. In the right panel, set the trigger to:Trigger App: KustomerTrigger Event: Message CreatedAdd an action step to look up the conversation from step 1.Action App: KustomerAction Event: Conversation: Lookup (By ID)Id (string): /#steps.1.conversationNext, set up any condition steps as desired to filter out certain types of messages. If you're following the tutorial example, you'd set up a condition that continues only if a conversation has a queue assigned.Next, add an action step to update the message by adding the conversation's queue as the message queue. This updates custom attribute on the message Klass, using the queue from the Conversation: Lookup (By ID) step.Action App: KustomerAction Event: Message: UpdateId (string): (1) Message Created > Id, or /#steps.1.idQueue (string): (2) Conversation: Lookup (By ID) > QueueNote: If you don’t see a field for Queue (string) or your custom attribute at this step, make sure you've created the custom attribute on the Message Klass.When you're finished with the workflow, Save it. After turning on this workflow, messages should now have a queue attribute saved to them, as long as the queue has been set on the conversation.Create the custom reportFinally, you'll set up a custom report that incorporates your new custom attributes.To create a custom report:Go to Reporting.From the sidebar, either create a new report, or select an existing custom report and select Add Chart from the toolbar.In the Chart Editor, select Start From Blank. Then, build your data with the following suggested properties:For the Data Object Type, select Message.For the Date Attribute, select Created At. This will show the total number of messages created during the selected time range, as long as there aren't any conditions or segmentation.For the Chart Type, we recommend selecting Table. This will show a simple view of the messages in each queue.Select Segment By: Queue to see how many messages were sent for each queue.Finish by adding any filter operators as desired. This would be a useful way to hone in your report to make it more relevant to the data you care about, by filtering out spam or only showing outbound messages.Select Next to finish your chart by customizing the title, description, axis label, and time interval as desired.When you're finished, Save your chart.You can now refer to this chart in your custom reports to see relevant data and improve your team's performance and efficiency.Move a generic email to correct customer's timeline
If your team receives multiple emails from a specific email address and those emails should go to different customer profiles based on the content containing the customer’s email address, you can set up a Kustomer workflow to automatically move those conversations to the correct customer.For instance, you receive multiple notification emails from an email address like noreply@provider-name.com about bookings from different customers that look like the below.This article will walk you through the steps to create a workflow that will move those email conversations to the correct Customer object.Who can access this feature?User typesAdmins can access the Workflows and API Keys pages.In this articlePrerequisitesCreate an API KeyCreate the workflowEnter the workflow JSON codeAdd the API key to the workflowCustomize the workflowWorkflow variationsPrerequisitesBefore following this guide, we recommend that you already be comfortable with the basics of using workflows.We also recommend being familiar with creating API keys and adding workflow variables.Create an API keyCreate an API key by going to Settings > Security > API Keys using the org.user.conversation.write and org.permission.conversation.update roles. Copy and save the token in a separate file for later use.Create the workflowNext, create a new workflow.Go to Settings > Platform > Workflows.Select Add Workflow. The New Workflow window opens.Enter a Workflow Title. You can leave the Description field blank because the code snippet below will provide this for you.Select Create to save the workflow and begin working in the Workflow Editor.Enter the workflow JSON codeUse the Workflow Editor to paste in the workflow code supplied below. This JSON code will take care of most of the workflow creation, aside from a few placeholder values that you'll need to update manually.In the Workflow Editor, go to Workflow Options and select Edit Workflow JSON.A window appears where you can edit the code for this workflow directly. Select and Delete the current JSON code.Copy the code block below, and paste it into the JSON text field in your Workflow Editor:{ "description": "This workflow will move conversations from a generic email address to their appropriate customer timelines", "name": "move-generic-emails-workflow", "steps": [ { "transitions": [ { "target": "Dy3rji789", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "e9Q4xexax", "appVersion": "kustomer-^1.5.3" }, { "transitions": [ { "target": "xJOlOMnuz", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "Dy3rji789" }, { "transitions": [ { "target": "aL8VV0VbX", "condition": { "op": "exists", "values": [ "/#steps.xJOlOMnuz.match", "" ] }, "meta": { "name": "Email Address Found in Body" } } ], "errorCases": [], "id": "xJOlOMnuz", "action": "kustomer.regex-match.generic", "params": { "regex": "([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z0-9_-]+)", "testString": "/#steps.1.body" }, "appVersion": "kustomer-^1.9.2", "meta": { "displayName": "Find Email Match in Message Body" } }, { "transitions": [ { "target": "2Re5lqKh-", "condition": { "op": "exists", "values": [ "/#steps.aL8VV0VbX.id", "" ] }, "meta": { "name": "Email Message is Found" } } ], "errorCases": [], "id": "aL8VV0VbX", "action": "kustomer.message.find-by-id", "params": { "id": "/#steps.1.id" }, "appVersion": "kustomer-^1.9.2", "meta": { "displayName": "Find Email Message in Kustomer" } }, { "transitions": [ { "target": "TOUPj-zBx", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "2Re5lqKh-" }, { "transitions": [ { "target": "71igq5x_v", "condition": { "op": "true", "values": [ true ] }, "meta": { "name": "stop" } } ], "errorCases": [], "id": "TOUPj-zBx", "action": "kustomer.customer.find-by-email", "params": { "email": "/#steps.xJOlOMnuz.match" }, "appVersion": "kustomer-^1.9.2", "meta": { "displayName": "Find Customer by Email" } }, { "transitions": [ { "target": "f-rngyCEV", "condition": { "op": "exists", "values": [ "/#steps.TOUPj-zBx.id", "" ] }, "meta": { "name": "Customer Found by Email" } }, { "target": "0xs6Bk29L", "condition": { "op": "exists", "values": [ "true", "" ] }, "meta": { "name": "Customer does not Exist" } } ], "errorCases": [], "id": "71igq5x_v" }, { "transitions": [ { "target": "G2spIjO8X", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "f-rngyCEV" }, { "transitions": [], "errorCases": [], "id": "G2spIjO8X", "action": "kustomer.rest-api.json", "appVersion": "kustomer-^1.9.2", "params": { "method": "PUT", "json": true, "headers": { "content-type": "application/json", "Authorization": "Bearer" }, "data": { "customer": "/#steps.TOUPj-zBx.id" }, "uri": "https://api.kustomerapp.com/v1/conversations/{{{steps.aL8VV0VbX.conversation}}}" }, "meta": { "displayName": "Move Conversation to Correct Customer" } }, { "transitions": [ { "target": "8J2fs1Oby", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "1pIJ1EyKn", "appVersion": "kustomer-^1.5.3" }, { "transitions": [ { "target": "mS7UMku22", "condition": { "op": "true", "values": [ true ] } } ], "errorCases": [], "id": "0xs6Bk29L", "action": "kustomer.customer.create", "params": { "email": "/#steps.xJOlOMnuz.match" }, "appVersion": "kustomer-^1.9.2", "meta": { "displayName": "Create New Customer" } }, { "transitions": [], "errorCases": [], "id": "mS7UMku22", "action": "kustomer.rest-api.json", "params": { "method": "PUT", "json": true, "headers": { "content-type": "application/json", "Authorization": "Bearer" }, "data": { "customer": "/#steps.0xs6Bk29L.id" }, "uri": "https://api.kustomerapp.com/v1/conversations/{{{steps.aL8VV0VbX.conversation}}}" }, "appVersion": "kustomer-^1.9.2", "meta": { "displayName": "Move Conversation to Correct Customer" } }, { "transitions": [ { "target": "e9Q4xexax", "condition": { "op": "eq", "values": [ "/#steps.1.fromEmail", "test@test.com" ] }, "meta": { "name": "Message from Specific Email Address" } } ], "errorCases": [], "id": "8J2fs1Oby", "appVersion": "kustomer-^1.5.3" } ], "trigger": { "transitions": [ { "target": "1pIJ1EyKn", "condition": { "op": "true", "values": [ true ] } } ], "eventName": "kustomer.app.postmark.message.receive", "id": "1", "appVersion": "postmark-^1.1.11", "meta": { "displayName": "Email Message Received" } } }Select Update to dismiss the JSON editor and save the changes to the workflow.The workflow will look like the below.Add the API key to the workflowIn the Workflow Editor, go to Workflow Options and select Workflow Variables.Add the saved token from the API key you created earlier as a workflow variable. Name the workflow variable as desired and add the token in the Value field.Save the variable, select Close to exit the workflow editor, and Save the updated workflow.Customize the workflowIn the first condition after the workflow trigger, customize the test email address to the email address(es) from where you receive multiple messages that should be moved to the correct customer timelines.In Steps 13 and 14 of the workflow, select the key icon in the REST API JSON action step to access the workflow variable saved, and copy the workflow variable.Add just one space after Bearer in the Headers section and paste the copied value which is the API token needed for authorization. The section should look like the below:If there are any other changes to the workflow that you'd like to make, you can do so now. When you're finished, Save all and other workflow changes.When you're ready to activate this workflow, use the toggle to switch it on or off.Workflow variationsYou can change the workflow’s initial trigger to create or duplicate this automation for messages received from other channels besides email. You’ll then modify the workflow steps to account for the message content and specific data to look for within the Message Data to find the target Customer timeline and move the conversations correctly.Use multiple conditions in workflows
When adding multiple conditions in a condition step in a workflow, you may need to decide whether all, or only one, of the conditions in your list should be met. This guide explains when to choose Multiple Conditions (or) or Multiple Conditions (and) for a list of conditions.Who can access this feature?User typesAdmins can access the Workflows page.In this article:PrerequisitesCreate a condition step with multiple conditionsWhen to use Multiple Conditions (or)When Not to use Multiple Conditions (or)When to use Multiple Conditions (and)PrerequisitesBefore following this article, we recommend that you are comfortable with the basics of using workflows.Create a condition step with multiple conditionsBefore or after any action step in a workflow, add a condition step. Let's say you want this step to have more than one condition, or a list of conditions to check against.You will be prompted to choose Multiple Conditions (or) or Multiple Conditions (and) as soon as you add a second condition.When to use Multiple Conditions (or)Use Multiple Conditions (or) if only one in the list of conditions needs to be met.For example, let's say you have the following conditions:Conversation is assigned to the Email Team.Conversation is in the Email Queue.Conversation channel includes Email.Selecting Multiple Conditions (or) will check the object against the list of conditions, in the order they are listed, from top to bottom. In this example, this will allow conversations matching only one of these attributes to pass the condition step.You can also use Multiple Conditions (or) for a set of negative conditions, but only if the object needs to match just one condition, and not all.In the below example, you can use the 'or' option if the object needs to match only one condition to proceed with the rest of the workflow steps:Conversation is not in Done status.Conversation is not assigned to a user.Conversation does not have an assigned team.When not to use Multiple Conditions (or)Do not use Multiple Conditions (or) for a set of negative conditions, if you want them all to be met.For instance, you want conversations matching the below conditions, to be marked done, or closed, by a workflow:Conversation is not from a VIP client.Conversation is not related to a complaint.Conversation is not in the Escalations queue.Instead of using 'or', you will use Multiple Conditions (and) in this scenario, since you want the conversation not to be from a VIP client, nor be a complaint, nor be in the Escalations queue.If you use the 'or' option, then a conversation that is not from a VIP client, but is a complaint, will pass the condition check, as it will have met the first 'or' condition on the list, and will be marked done.When to use Multiple Conditions (and)Use Multiple Conditions (and) if all conditions on the list need to be met. This goes for a set of positive conditions (for example, exists, contains, or equals):or a list of negative conditions (for example, does not equal, does not contain, or does not exist):
Still need help? Contact Us