Tutorial: Setting up an inbound webhook for CSV (Console)
Console > Integrations > Tutorial: Setting up an inbound webhook for CSV (Console)
This article walks through how to set up a CSV inbound webhook.
Prerequisites
This tutorial requires a basic understanding of how to use API testing tools like Postman.
Overview
In Console, you can use inbound webhooks to receive data from third-party applications. When an inbound webhook receives data, a workflow linked to the inbound webhook runs and processes the inbound data.
There are four types of inbound webhooks, classified by the type and origin of the data they transmit:
CSV inbound webhooks receive data in CSV (comma separated value) format. CSV inbound webhooks aren’t tied to any specific third-party application (like Salesforce or Zendesk), so they can be used in a wide variety of applications.
CSV inbound webhooks are unique in that they run for each row in the CSV. For example, if you have a CSV list of 100 interactions you’d like to create in a queue, using a CSV inbound webhook will make a workflow run 100 times – once for each row in the CSV – to import the interactions.
This article covers how to create a CSV inbound webhook, including:
How to create a workflow for testing, and
How to use API testing tools to verify that the inbound webhook is working correctly
Continue reading this article to learn how to set up a generic inbound webhook to transmit CSV data to your Avaya.cx account.
Before starting
We recommend that you read this overview article on inbound webhooks before proceeding with these steps. It will help familiarize you with inbound webhooks in general.
Part 1: Setting up a test workflow
In our system, an inbound webhook triggers a workflow to run whenever it receives data. The easiest way to determine whether an inbound webhook is working correctly is to create a test workflow that runs when the inbound webhook receives data.
For the purposes of this article, we’re using a very simple workflow with the Send SMS workflow module. The workflow will send an SMS with variables that contain data received from the inbound webhook. The goal of this exercise is to demonstrate that the webhook is sending data to the workflow and that the workflow is able to access the webhook’s data.
The example workflow is used only for testing. It sends a text message containing a firstName variable, a lastName variable, and a favoriteColor variable. These variables will be retrieved from the inbound webhook data.
Create a workflow with three modules:
Start module
Send SMS module
End module
In the Send SMS module, configure the module to send an SMS message to a phone number. This phone number should be easily accessible (like your personal cell phone number).
In the Send SMS module, configure a message that includes the following variables:
{{firstName}}
{{lastName}}
{{favoriteColor}}
See the screenshot above for an example of how this should look.
Note: The variables you enter must match exactly the name of the data sent via the webhook. For example, if the webhook receives data called firstName, the variable must also be called {{firstName}} (wrapped in curly brackets).
Publish the workflow.
Once you’ve published the workflow, continue on below to create an inbound webhook.
Part 2: Creating an inbound webhook in Console
The next step to creating an inbound webhook for processing JSON, XML, or form encoded data is to create an inbound webhook in Console.
Follow the steps in this article to learn how to create an inbound webhook: Create an inbound webhook
Note: Make sure to connect the workflow you created in Part 1 to the inbound webhook you create during this step.
Once you’ve created an inbound webhook in Console (Account > Integrations), return to this article to continue to Part 3 and test sending data via the webhook.
Part 3: Sending data to the inbound webhook
Once you’ve completed Part 2 above, the next step is to test sending data into your account via the inbound webhook.
Note: For this section we’ll use Postman, but you can use any API testing tool you prefer.
Note: You can also test sending a CSV to the webhook from the configuration page of the inbound webhook by clicking the Import CSV button.
1. Choose your preferred API testing tool. For this article, we’ll be using Postman.
2. Navigate to Account > Integrations > Inbound Webhook.
3. For the webhook you have configured for generic data, click the Copy URL button. The URL is the endpoint you’ll send data to for triggering the webhook to run the workflow.
4. Launch Postman and create a new, blank request.
5. Paste the URL you copied above into the URL field and make sure the HTTP method is set to POST.
6. Click the Body tab.
7. To test CSV capability, create a CSV file containing the following data:
firstName,lastName,favoriteColor
Isaac,Newbury,blue
Bennie,Franks,green
Stefan,Hawkston,yellow
8. Attach the CSV file to the Postman body.
9. Click Save to save the request.
10. Click the Send button to send the request.
Note that, in this CSV file, there are three lines (excluding the header). This means that the workflow connected to the inbound webhook will run three times – once for each line.
Expected results
After clicking Send, Postman (or your preferred API testing tool) should send the CSV data to the URL of your inbound webhook. The inbound webhook should then run the workflow linked on the webhook.
If you created a test workflow in Part 1, you should have received three text messages after executing the inbound webhook saying something along the lines of:
Hello! My name is Isaac Newbury. My favorite color is blue.
Hello! My name is Bennie Franks. My favorite color is green.
Hello! My name is Stefan Hawkston. My favorite color is yellow.
Note that the words first name, last name, and favorite color in each SMS are derived from the variables sent via the inbound webhook.
Read more
Now that you’ve configured a simple CSV inbound webhook, you’re ready to start building more complex webhooks and workflows. In this tutorial, we sent just basic data, but you can configure an inbound webhook to receive virtually any data.
Click any of the links below to learn more about inbound webhooks or about workflows to start building webhook integrations into your Avaya.cx account.