WhatsApp

Introduction

This document provides a comprehensive guide on integrating Autom Mate with WhatsApp, allowing users to automate processes and interactions within the WhatsApp Business application. It outlines the process of defining and managing credentials within the Autom Mate Vault for secure authentication.

WhatsApp Business is a dedicated application designed for businesses to communicate with their customers via WhatsApp. Businesses can utilize features such as automated replies, predefined messages, chatbots, and dashboards to enhance customer interactions and streamline customer service tasks.

What is WhatsApp Business?

An overview of WhatsApp Business, emphasizing its role in facilitating business-to-customer communication and the features it offers.

Overview of WhatsApp Business: WhatsApp Business is an application tailored for businesses, enabling them to communicate with customers via WhatsApp. It provides tools such as automatic replies, predefined messages, chatbots, and dashboards to enhance customer engagement and support.

Key Features:

  • Automatic Replies

  • Predefined Messages

  • Chatbots

  • Dashboards

Autom Mate Integration with WhatsApp

Description of how Autom Mate seamlessly integrates with WhatsApp Business, offering actions to automate messaging, list creation, button responses, and media sharing.

Overview of Integration: Autom Mate enables users to perform various operations within the WhatsApp app. It provides actions such as creating structured lists, sending text messages, sharing media, and setting up interactive buttons for quick responses.

Prerequisites

  1. WhatsApp Business Account: You must have a WhatsApp Business Account. This is necessary for any integration with the WhatsApp Business API.

  2. Facebook Business Manager: Since 360 Dialog is an official WhatsApp Business API provider, you will need to have a Facebook Business Manager account that is verified. This is important for linking your WhatsApp number to the API.

  3. Phone Number: A dedicated phone number that hasn’t been used with WhatsApp Business API before. This number will be registered with your WhatsApp Business API profile.

  4. API Access: You need to apply for API access through 360 Dialog, which involves agreeing to specific terms of service and potentially undergoing a review process.

  5. Technical Setup: Understanding of API integration is crucial. You should be comfortable with concepts like webhooks, JSON formats, and HTTPS requests.

  6. Security Compliance: Ensure that your systems comply with WhatsApp’s and 360 Dialog’s security and data protection guidelines. This might involve implementing secure storage for authentication tokens and message content.

Using the Integration

Credential Management

Steps to define and manage credentials within the Autom Mate Vault for secure authentication in WhatsApp operations.

Usage:

  1. Navigate to the Autom Mate Vault section.

  2. Click on "Add New Credential" to define a new credential.

  3. Fill in the required fields:

    • Credential Name: Unique identifier for the credential.

    • Authentication Type: Method used for authentication (e.g., API Key, OAuth).

    • WhatsApp Business API Token: Token provided by WhatsApp Business API.

    • Additional Fields as required.

  4. Save the credential in the Autom Mate Vault for secure storage.

Credential Usage

Instructions on how to utilize credentials from the Autom Mate Vault in WhatsApp operations.

Usage:

  1. When setting up Autom Mate WhatsApp actions:

    • Select the option to use Vault-managed credentials.

    • Choose the desired credential from the Autom Mate Vault.

  2. Authenticate securely using the selected credential.

  3. Execute the WhatsApp operation with enhanced security and access control.

How To Use Actions

List Scope

Description: Allows creation of a structured list within a chat for organized information display.

Purpose: Organize information in an easily navigable format for users.

Usage:

  1. Select the "List Scope" action in Autom Mate.

  2. Choose to use Vault-managed credentials for authentication.

  3. Define the label, header, body, footer, and button text for the list.

  4. Add list items to populate the list with relevant information.

Inputs:

  • Label

  • Header

  • Body

  • Footer

  • Button Text

List Item

Description: Individual items within the list scope with specific details and actions.

Purpose: Provide detailed information and actions for each item in the list.

Usage:

  1. Select the "List Item" action in Autom Mate within a List Scope.

  2. Specify the label, title, description, and response for the list item.

Inputs:

  • Label

  • Title

  • Description

  • Response

Dynamic List

Description: A dynamically populated list from a data source.

Purpose: Fetch data from a source to create a list dynamically.

Usage:

  1. Select the "Dynamic List" action in Autom Mate.

  2. Choose to use Vault-managed credentials for authentication.

  3. Define the label, request URI, response title path, response description path, authentication method, HTTP method, header, and query params.

Inputs:

  • Label

  • Request URI

  • Response Title Path

  • Response Description Path

  • Authentication

  • Method

  • Header

  • Query Params

Button Scope

Description: Create a set of interactive buttons within a chat for quick replies or actions.

Purpose: Enable users to interact with predefined actions or responses.

Usage:

  1. Select the "Button Scope" action in Autom Mate.

  2. Choose to use Vault-managed credentials for authentication.

  3. Define the label, header, body, and footer for the button scope.

  4. Add button items to create interactive options for users.

Inputs:

  • Label

  • Header

  • Body

  • Footer

Button Item

Description: Individual buttons within the button scope with specific actions.

Purpose: Provide selectable options with defined responses or actions.

Usage:

  1. Select the "Button Item" action in Autom Mate within a Button Scope.

  2. Specify the label, title, and response for the button item.

Inputs:

  • Label

  • Title

  • Response

Text

Description: Send plain text messages within the chat.

Purpose: Share information or responses in text format.

Usage:

  1. Select the "Text" action in Autom Mate.

  2. Choose to use Vault-managed credentials for authentication.

  3. Enter the label and message text to send.

Inputs:

  • Label

  • Message Text

Send Media

Description: Send media such as images or videos within the chat.

Purpose: Share multimedia content with users.

Usage:

  1. Select the "Send Media" action in Autom Mate.

  2. Choose to use Vault-managed credentials for authentication.

  3. Specify the label, media type, link to the media, and optional caption.

Inputs:

  • Label

  • Media Type

  • Media Link

  • Caption

Additional Tips

Use Cases

FAQ (Frequently Asked Questions)

Notes

  • Creating the credential for using WhatsApp actions

Under the Management > Vault in Autom Mate web interface, you need to press to the “New Credential” button under the Application Credentials.

In the pop-up screen you need to choose WhatsApp which you can locate at the end of the pop-up.

When you pressed the WhatsApp button, the credential page will appear. The fields at the page are explained below.

Connector Name: The name that you want to give to your credential. EG: “My WhatsApp Credential”

Authentication Type: The provider that you are receiving your WhatsApp bot is defined in this field.

EG: 360 Dialog

WhatsApp Service URL: The URL that the WhatsApp instance is working on. The default URL for 360 dialog is https://waba.360dialog.io/

WhatsApp API Key: The unique API Key that the provider defines for your account.

Set as Default: When you drag and drop in any WhatsApp action in your flow the default WhatsApp credential will appear already selected.

After all the information firstly, we need to press to the “Test Connect” button to see if the data that we provided is valid. If we get a success message we can continue with “Connect & Update” button. Or else, we need to check the credentials that we write to the fields once again.

  • Creating the WhatsApp Flow

When we create a new flow for WhatsApp, we need to set the trigger type as “Webhook” to run it.

If the API key for the Autom Mate user was not created, there will be no API key at the end of the webhook URL and it won’t work because of it. For creating the API key, you need to press to the “?” icon on the left down part of web interface and choose “API key generate”.

If there is an API key visible to you when you press the button, it means that the user you are logging in has already created it and you can skip it.

After creating the API key, you can put the Webhook as Trigger to your flow.

The Webhook that we see is a unique webhook address that Autom Mate generates. Now, we need to redirect the WhatsApp number to the flow that we created to be able to use the flow variables that we are putting inside.

For doing this we are firstly adding a POST method to the flow.

POST METHOD

In the Request URL we are providing the webhook URL, which is https://waba.360dialog.io/v1/configs/webhook

At the Authentication section, we don’t need to provide an Authentication type. We will do it on the header side.

On the Header, we need to add a customer string. The Key value will be D360-API-KEY and the value will be the API that 360 dialog provides.

On the Content Type, we need to provide the webhook URL that we configured for the Autom Mate flow. Because for this, we will be choosing “application/json” as the type. You can press the “Configure Trigger” button under the trigger part and copy the webhook URL.

EG:

{

"url": "https://ithero.autommate.app:443/api/v1/automs/run/a391cc9f-4d17-4a58-b77a-99d8f0ab3b5d?apiKey=JMB9NNZ-*******-*******-*******"

}

As the response value, we can use any random variable because when we run the flow the process will be ended and we will delete the POST action.

For being able to that if the POST method that we created worked as we wanted, we can add a Display Message action under the POST action and put the response value of the POST action to the Message part of the Display Message.

When you save it and run it, if you are seeing the json that you provided as a response, the operation is succesfful and you can now use your WhatsApp bot in thie flow that you POST the webhook of.

After this you can delete the POST and Display Message actions and go with last step before starting to build the flow.

  • Webhook Rule Defining

In WhatsApp, when the user writes anything to the chatbot there will be 3 actions triggering on the WhatsApp’s API side. Trigger for message sent, message delivered and message read.

Every trigger comes to our trigger condition because of the webhook already connected with our chatbot.

In the monitoring side of Autom Mate, if we look at the History section after sending a message to the chatbot we will see 1 Completed and 3 Failed as it shown on the below screenshot. This is because webhook only able to read the data that has a specific json field called “contacts” in it.

This situation is not an issue but will create unwanted number of logs to monitor in our system. To prevent it we need to create a rule from Management > Webhook API menu. In this menu we will press the “Add Rule” button and a pop-up comes on the screen to start the process.

In the Details page, we will define a name and description for our rule.

In the Rule page, we will define the condition to make our webhook work without flaws.

In our case, the rule should be like this:

Params = Body

Key = contacs

Operator = is exist

Status = 200

When we put all the rules, we are pressing the Add button at the end and pressing next to continue.

At the Add Autom side, you can choose the WhatsApp flows that you already created and when you select them and press add rule, the operation will be done.

Now every step is done and we can continue to building the flow itself.

Triggering the WhatsApp flow which is created

WhatsApp “sessions” will be initiated when a user writes to the WhatsApp number that we directed it’s API to our Webhook.

After the first message that is sent to the number, the Webhook will be triggered and the rest of the session will go through the flow that we created.

Building the WhatsApp flow

Under WhatsApp application, there are 7 different actions that we can work with in the flow.

  • Text

  • Button Scope

    • Button Item

  • List Scope

    • Dynamic List

    • List Item

  • Send Media

Last updated