# How to connect WhatsApp with a human-agent service

Conversation Management is powered to interact with customers via various messaging platforms such as WhatsApp, LINE, Facebook Messenger, etc. in integration with Quickwork Journey Builder. The **Multichannel** feature allows admins and agents to communicate with customers available on any of the above-mentioned messaging platforms and enables them to view all the conversations in real-time on a single dashboard. Messages received through different channels get highlighted with respective channel identifiers. Looking at this, it becomes easy for an agent to identify the point of origin of the customer and what the nature of communication will be. This helps to broaden the customer’s reach by not just getting confined to the website portal. &#x20;&#x20;&#x20;

Communicating with customers on their choice of messaging platforms imposes a good sign of future relations instead of begging the customer to move to a confined chat window for any purpose.

To understand multichannel more in detail, let's take a use case and build a journey that explains the functionality more precisely.

## **Use case**

Communicate with a **WhatsApp** user and make him/her understand the product functioning using **Conversation Management** as a messaging platform.&#x20;

To implement this use-case, we need to build two journeys with the following two adaptors which will execute in synchronization for the flow of messages in real-time:

1. Conversation Management by Quickwork
2. WhatsApp by Gupshup

## Prerequisite

According to the use case, the user should have an active Whatsapp Business account with access to Whatsapp Business API. The user can then integrate these platforms with Conversation Management using [Quickwork](https://docs.quickwork.co). Here in the example, we'll be using WhatsApp by Gupshup APIs to integrate and communicate. Before integration, a user must have an app registered in his/her Gupshup account. Follow these steps to do so:

1. &#x20;Log in to [WhatsApp by Gupshup](https://www.gupshup.io/whatsapp/dashboard) account using Google sign-in. \
   \
   **Note**: The same WhatsApp by Gupshup account to be used for authorization while configuring the journey in Quickwork.<br>
2. You'll be redirected to the **WhatsApp** dashboard.
3. Click the blue-colored **+** icon to create a new **WhatsApp Messaging App**. Then click the **Access API** button.
4. Enter the name for the Whatsapp app you are creating, say **ConversationManagementMultiChannel**. The user will interact with this bot on WhatsApp in the execution phase:

![Figure 1: Creating an app in WhatsApp by Gupshup](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mketeaw_VuCgRJqm8mX%2F-Mkeuu6-hS4rHLP6-qce%2Fimage.png?alt=media\&token=36f54d72-277a-404e-a14b-8a7aca5da9d7)

&#x20;  5\. Click the **Submit** button. You'll be driven through a couple of steps that\
&#x20;      give an overview of the app created. Simply click on the **Next** button. Your app has now been created\
&#x20;      successfully. You can check the phone number allotted to you in the **Send messages to desired**\
&#x20;      **recipients** section.

{% hint style="info" %}
Gupshup provides a sandbox environment supporting WhatsApp APIs with a static phone number using which testing of an app and configuring a journey could be done easily.
{% endhint %}

## Creating an inbox

Go to Conversation Management and create a multichannel inbox named **Whatsapp communication**. To do this, click on the gear icon (**Settings**) > **Inbox Settings** > click the **Add New Inbox** button > and select the **Multichannel** option:

![Figure 2: Multichannel inbox](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mketeaw_VuCgRJqm8mX%2F-MkevKOTJ4yy3bykTBEH%2Fimage.png?alt=media\&token=d226c543-659b-4a68-b0b4-978ba549cba1)

Enter the name for the inbox as **WhatsApp communication** and click **Continue**. Add any agents if you want and proceed further. Your inbox is ready. Now to monitor the conversations belonging to this specific inbox, click the **Conversations** icon and select **WhatsApp communication**. You'll be redirected to its conversation dashboard which is blank as of now:

![Figure 3: WhatsApp communication inbox](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mketeaw_VuCgRJqm8mX%2F-MkevwVvT7gJCVT-bzeE%2Fimage.png?alt=media\&token=cd1bdd86-f028-4dc7-bf7c-cbbb149c547d)

## Creating the first multichannel journey

Let's create a journey that will fetch a new message from a WhatsApp user and forward it to a Conversation Management agent

### Configuring the trigger

1. Create a new journey named **New message from WhatsApp user**.
2. Under the **Event** section, choose the **WhatsApp by Gupshup** app from the drop-down menu in the **Apps** field present right below the **New Trigger** button.
3. Select the trigger event, **New text message**, from the drop-down menu in the **Triggers** field.
4. For authorizing and connecting your **WhatsApp by GupShup** account, select an existing connection from the drop-down or create a new connection. Click [here](https://helpdesk.quickwork.co/hc/en-us/articles/360051441473-WhatsApp-by-Gupshup-Connecting-your-account) to know how to create a new connection. While creating a new connection, a **Connect to WhatsApp by Gupshup** dialog box will appear. Fill all the required fields carefully as shown below:

![Figure 4: WhatsApp by Gupshup connection window](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mketeaw_VuCgRJqm8mX%2F-MkewvWVN47eJaU3Bokk%2Fimage.png?alt=media\&token=29a61696-4e2b-464c-985c-11b830c164f7)

5\. The input fields will open up automatically after a successful connection. In the **Message** field, enter the welcome message for the user. E.g., *Hello, welcome to Conversation Management multichannel service. How may I help you?* and select **Yes** as an input to **Send Welcome Message**:

6\. As soon as you do this, Journey Builder will return a Callback Webhook URL as shown in the following figure. You need to paste this URL to listen for incoming messages from WhatsApp user:

![Figure 5: The webhook URL](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mketeaw_VuCgRJqm8mX%2F-MkexGpph0RPFgNnQKWu%2Fimage.png?alt=media\&token=14712118-94eb-478d-98f6-17bd37b87e0d)

7\. Copy this URL, go to your app created in **Gupshup**, click the **ConversationManagementMultichannel** app, and search for the **Callback URL / Link your Bot** section. Now, toggle **ON** to enable the **Enter your Callback URL** field, paste the above callback URL, and click **Set**:

![Figure 6: Specifying the webhook URL](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-MkexW1FvpG2pwXq1CIa%2F-MkexsBFHn3FCighoqsK%2Fimage.png?alt=media\&token=641ccc61-423c-4dd8-9f98-5dae3700a40f)

8\. Your successfully configured trigger will look like this:

![Figure 7: WhatsApp by Gupshup trigger](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-MkexW1FvpG2pwXq1CIa%2F-MkeyPSCjfnpdxx_u6Ag%2Fimage.png?alt=media\&token=0d7a9111-af61-401d-89aa-e091a1cb3b4e)

### Configuring the action

To do this, follow these steps:

1. Under the **Steps** section, click the **SImple Action** button.
2. Choose the **Conversation Management by Quickwork** app from the **Apps** drop-down menu field.
3. Select the **Forward message to agent** action in the **Actions** field.
4. Connect the **WhatsApp communication** inbox to establish the connection. Click the **Link an account** button and specify the **API key** and **Inbox ID** of this inbox. You'll get these in the **Toolkits** window of the **WhatsApp communication** inbox. Click the **Link account** button:

![Figure 8: Conversation Management connection window](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-MkexW1FvpG2pwXq1CIa%2F-Mkf-dVpSLXT_x5o5bZe%2Fimage.png?alt=media\&token=fc939e1b-f6a6-4d28-a4a6-e8ea38c73352)

{% hint style="info" %}
The API key is common for all the inboxes of an account whereas Inbox ID is unique for each inbox.
{% endhint %}

5\. The input fields will open up automatically after successful connection establishment. Drag the `Sender ID` and `Text` data pills from the **Data Tree Output** and drop it in the **Multichannel identifier** and **Message** fields, respectively. Select **WhatsApp** as the **Multichannel** type from the drop-down given. Your action should now look as below:

![Figure 9: Forward message to agent action](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-MkexW1FvpG2pwXq1CIa%2F-Mkf3J79XhgpJHbD6Yqj%2Fimage.png?alt=media\&token=cd3639a4-ad2e-4557-9d30-fdce28058af3)

6\. The journey is now successfully configured. Click the **Save changes** button and start the execution by clicking the **Save & Start** button.

## Creating the second multichannel journey

Let's configure the second journey that will allow an agent to reply to user's queries on WhatsApp via the Conversation Management portal.&#x20;

### Configuring the trigger

&#x20;To do so, follow these steps:

1. Create a new journey named **Reply from QC agent to the WhatsApp user**.
2. Under the **Event** section, choose the **Conversation Management by Quickwork** app from the drop-down menu in the **Apps** field present right below the **New Trigger** button.
3. Select the trigger event, **New agent message**, from the drop-down menu present in the **Triggers** field.
4. From the drop-down menu of selecting the existing connection, use the same connection that you had created in the previous journey with the inbox named **Whatsapp Communication**.
5. In the **Event** field, mention **Message from an agent.** The journey builder will return a webhook URL as shown in the following figure:

![Figure 10: The webhook URL](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mkf3YPMs2xDITirD_Of%2F-Mkf4WVAL0w-o2cpnf9p%2Fimage.png?alt=media\&token=aaa5a45a-d068-472f-abe3-d7baa6f68fd7)

&#x20;    6\. Now, copy this URL and go to the **WhatsApp communication** inbox in your Conversation\
&#x20;         Management account. Then, go to the **Webhook** tab of the inbox and paste this webhook URL in the\
&#x20;         **Agent Response Webhook** field:

![Figure 11: Pasting the webhook URL](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-MMoBGTfHSUSGVYv2jri%2F-MMoBYsokC_hC9TXeHoe%2Fimage.png?alt=media\&token=a981547c-5c8e-4ad9-9051-eb8d3cdaf76e)

&#x20;    7\. Click the **Save Changes** button.\
&#x20;    8\. The successfully configured trigger will look like this:

![Figure 12: New agent message trigger](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mkf3YPMs2xDITirD_Of%2F-Mkf6TrP-TU1cRwnIV0i%2Fimage.png?alt=media\&token=82e91013-350a-490d-8e9a-c2dbdfc1bbb6)

### Configuring the action

To do this, follow these steps:

1. Under the **Steps** section, click on the **Simple Action** button and choose the **WhatsApp by Gupshup** app from the drop-down menu in the **Apps** field.
2. Select the action, **Send message**, from the drop-down menu in the **Actions** field.
3. From the drop-down menu, select the existing connection and connect the same WhatsApp by Gupshup account as we had done for the previous journey:
4. In the **Message** and **Phone number** field, pass the `Content` and `MultiChannel Identifier` key from the **Data Tree Output**, respectively:

![Figure 13: Send message action](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mkf6iOkmCJlLMs7Rs5q%2F-Mkf8VOhzEncS-53CUJ2%2Fimage.png?alt=media\&token=0dd58201-da18-43ed-bc5b-c55f19e98f82)

&#x20;     6\. The journey is now successfully configured. Click the **Save changes** button\
&#x20;          and start the execution by clicking the **Save & Start** button.

### Activating the app on WhatsApp

Go to your WhatsApp by Gupshup account, click the **ConversationManagementMultiChannel**, and scroll down to the **Smart mechanisms to get active and opted in users** section. Go to the **Click URL** option and copy the URL: &#x20;

![Figure 15: Activating the app through a URL](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M34pLt4SmVLxK2J-oXh%2Fuploads%2F31k6KCoK0PSxlJW6hs2V%2Fimage.png?alt=media\&token=5e52a205-e841-4b74-9344-70a5459a7c38)

Paste it into the new tab to open it. The web version of WhatsApp will open with the pre-defined command **PROXY ConversationManagementMultiChannel** in the text field. Click the **Continue to Chat** button:

![Figure 16: Opening the app on WhatsApp](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M34pLt4SmVLxK2J-oXh%2Fuploads%2F19QZWsgONhFilabgX3ez%2Fimage.png?alt=media\&token=b109d80c-59ff-41c2-8334-c086905b4810)

Click the **Use Web version** option. If you haven't linked the web version of WhatsApp, you'll be asked to do so.&#x20;

Send the command **PROXY ConversationManagementMultiChannel** to the WhatsApp by Gupshup chat account. You'll receive the welcome message confirming that the app is now connected successfully:

![Figure 17: Activating the app](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M34pLt4SmVLxK2J-oXh%2Fuploads%2F1vE6s6ON61V3LjaMQ4Ew%2Fimage.png?alt=media\&token=9587e918-8cb6-4178-b902-f2688d767dd2)

## Executing the multichannel functionality

Now let’s send a **Hi** and check if the agent receives the message on the dashboard or not.

Now to check whether the agent has received the message or not. Let’s get back to the Conversation Management dashboard. Click on the **Conversation** icon on the left-hand side and select the inbox named **Whatsapp Communication**. Now in the filters drop-down which is located exactly beside the inbox name, select the **Mine** and **Resolved** filters:

![Figure 18: Message from a user](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mkf9UnZ-22NJiq2FF_V%2F-Mkfaeed0Eza-sZF8dpI%2Fimage.png?alt=media\&token=7ad30206-0fc0-4019-b5f0-2a043ba11e41)

Now, the agent can start sending responses to the user's message from this portal and a user can follow up with the agent directly on Whatsapp:

![Figure 19: Agent's response](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mkf9UnZ-22NJiq2FF_V%2F-MkfbAgnSsMC1BSuh6Gc%2Fimage.png?alt=media\&token=2c9e1bdb-56a0-425e-a84c-9a7def1ea88b)

The agent's response gets automatically synced on WhatsApp as per the execution of the journey and the user gets a response for the concern raised. This can be clearly seen in the following screenshot:

![Figure 20: Conversation on WhatsApp](https://1811093075-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M34pLt4SmVLxK2J-oXh%2F-Mkf9UnZ-22NJiq2FF_V%2F-Mkfc0EnyCoMD9Asr2qm%2Fimage.png?alt=media\&token=59e4c0d9-3c30-4422-b408-5f3bafa3e0c5)

Hence, this is how a human agent can connect with a user on WhatsApp with the help of Conversation Management and Quickwork. The same functionality can also be used to achieve the goal of connecting with customers on messaging platforms like Facebook, Line, etc., the only condition being that the steps for creating a connection with the respective platform and the input fields for sending messages will differ.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chat.quickwork.co/how-to-connect-whatsapp-with-a-human-agent-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
