Use workflows to import data
Last Update: Sep 2024 • Est. Read Time: 5 MINKustomer offers a variety of ways to import additional data into our platform. For example, you may want to import customer lists, past orders, past conversations, users, or even new conversations from a contact form on your website.
In this article, you'll learn about using one of Kustomer's most powerful features, Workflows, to bring your data into Kustomer. Workflows are an advanced Kustomer feature that allow you to build automations that activate whenever a specified event occurs in Kustomer or any connected app.
Kustomer also offers a less technical import method called Data Connect, which is a guided setup wizard that captures data through a webhook without having to set up a workflow. Learn more about this in our help article for Data Connect.
Who can access this feature? | |
User types | Admins can configure workflows. |
In this article
- What are workflows?
- What are hooks?
- Why import data?
- Step 1. Create a webhook to use in your workflow
- Step 2. Create a workflow to import data
- Step 3. Send data to Kustomer
- Step 4. Build out the workflow to import data into customers' timelines
What are workflows?
Workflows can import data into Kustomer using web, form, and email hooks. Post your data to a webhook, form hook, or email it to an email hook. Then, set up the rest of the workflow to process the data in Kustomer. Workflows in Kustomer represent a set of defined rules used to automate processes.
What are hooks?
Hooks are a flexible way for 3rd party applications to sync data with Kustomer. There are three types of hooks available in Kustomer, and each has unique attributes:
- Webhooks are a URL that provides a way for an application to send Kustomer real-time information. This requires the application to POST data to the webhook URL so Kustomer can read the data. Posting to a Kustomer webhook requires a Kustomer API key with
org.hook
permission. - Form hooks are similar to a webhook, a URL that provides a way for an application to send Kustomer real-time information. This requires the application to post data to the form hook URL so Kustomer can read the data. Posting to a Kustomer form hook does not require an API key.
- Email hooks provide a way to email real-time information to Kustomer via a unique email address.
Why import data?
Common use cases for importing data into Kustomer include:
- Sending data from your website's Contact Us form. To do this, you would create a form hook and configure your Contact Us form to POST to it. Then, you would set up a Workflow to ingest the data from the form hook, and create a new conversation in Kustomer to represent the data sent from the Contact Us form.
- Sending data from your admin system to create or update customers in Kustomer
- Sending data from your admin system to create an order in a customer's timeline in Kustomer. You could achieve this by creating a webhook and configuring your admin system to POST data you want to see in Kustomer to the webhook. A webhook requires a Kustomer API key to make sensitive customer information is securely transferred. Set up a workflow to ingest the data from your admin system. Use this data to create a new order object in your customer's timeline.
Step 1. Create a webhook to use in your workflow
First, we'll need to create a new hook.
- In Kustomer, go to Settingsand select Platform > Inbound Webhooks.
- Select Add Inbound Webhook.
- Fill out the name and description of the new webhook.
Note: 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 webhook performs if another member of your team reviews it at a later date.
- Select your choice between creating a web, form, or email hook based upon your needs.
- Then, select Create to save the new webhook.
Step 2. Create a workflow to import data
Next, we will create the workflow itself.
- Go to Settingsand select Platform > Workflows.
- Select Add Workflow, then select Custom Workflow.
- Give your workflow a name and description so it's easy to reference later, then select Create.
- Select your newly-created webhook as the workflow's Trigger Event.
Step 3. Send data to Kustomer
This workflow will run whenever its defined trigger event is triggered. In our example, we will choose Hooks as the Trigger App and a hook as a Trigger Event.
Configure your system to make an HTTP POST
request to the webhook URL and send along any data you'd like to see in Kustomer. For example, if you'd like to see a customer's order in their Kustomer timeline, send the order data payload to the webhook URL. Remember to include a Kustomer API token with org.hook
permissions when posting to a Kustomer webhook.
Review the Example Data Payloads article to reference what a data payload coming into Kustomer would look like.
Step 4. Build out the workflow to import data into customers' timelines
Now that you're sending data to a Kustomer webhook, it's time to build out the rest of your workflow to manage how the data is represented in Kustomer. The workflow will look something like this:
This workflow will run whenever the Admin-Import-Order hook is triggered, meaning it has received data. After receiving data from the webhook, the workflow finds the customer by email. To do this, it uses information sent over to the webhook, which can be accessed by the workflow using the following syntax:
/#steps.1.attributes.data
We can drill down to the customer email we sent over to the webhook using the following syntax:
/#steps.1.attributes.data.customer.email
The action step Customer Find By Email will either return a customer in your Kustomer org or not find that customer by their email.
Note: Sometimes you may have a customer in Kustomer without an email. To handle these cases, workflows also have action steps, Customer Find By Phone and Customer Find By External Id.
To handle each case we use condition steps like Customer Exists and Customer DNE.
If the customer exists, the workflow uses action step KObject Create With Customer to create a custom object (KObject) in the customer's timeline with the data sent over to the webhook.
Note: You'll need to have already created a KObject in your Kustomer organization to reference in this step as KlassName. To create a KObject, create a new Klass (KObject) in Settings > Klasses. You can also design the look of your KObject by in the Timeline Layout or Insight Card tabs.
If the customer does not exist in your Kustomer organization, then the Workflow uses action step Customer Create to first create the customer and uses KObject Create With Customer to create the KObject in the newly created customer's timeline.
That's all you need to import data into Kustomer. There are many different ways to handle imported data. Customize your workflows to create and update customers, to create and update orders, or anything else you'd like to see in Kustomer.