Vonage: Connect Cognigy.AI to WhatsApp

Table of Contents

  1. Tutorial Video
  2. Vonage - Setup API
  3. Cognigy.AI - Setup Endpoint & Transformer
  4. Provided Message Types

Tutorial Video

Vonage - Setup API

Before Cognigy.AI can send messages through the WhatsApp messenger, one has to set up a Vonage API account. In order to do so, various steps need to be followed:

  1. Login to the Vonage API Dashboard.
  2. Now, one should see the Dashboard overview, including the API credentials:

    vonage-api-information.png
    The API Key and API Secret are required for further steps inside Cognigy.AI
  3. In order to enable WhatsApp, navigate to Messages and Dispatch -> Sandbox -- inside the left menu bar.
  4. Inside of the Setup your Sandbox section, one can enable WhatsApp by clicking on the related button. Afterward, a QR code and the test mobile number are displayed:

    vonage-whatsapp-sandbox.png

  5. Last but not least, the so-called Webhook URL needs to be provided in Vonage. Below the Sandbox, one will find two text fields:

    vonage-whatsapp-webhook.PNG

  6. Follow the next chapter in order to get the required Webhook URLs from the Cognigy.AI Endpoint.

Cognigy.AI - Setup Endpoint & Transformer

Such as mentioned in the previous chapter, the Cognigy.AI side of the connection is missing. Please follow these steps in Cognigy.AI:

  1. Login to Cognigy.AI.
  2. Create a new Agent.
  3. Now, navigate to Deploy -> Endpoints and create a new Webhook Endpoint.
  4. The so-called Endpoint URL needs to be copied and inserted into the Webhook text fields inside the Vonage API Dashboard:

    cognigy-webhook-endpoint-url.png

  5. Inside of the Webook Endpoint configuration in Cognigy.AI, scroll down and expand the Transformer Functions section.
    1. Click on Enable Input Transformer and Enable Output Transformer.
    2. Finally, paste the entire source code into the dark code window.
    3. Inside of the code, provide your Vonage WhatsApp Phone number as FROM_NUMBER
  6. Last but not least, Cognigy.AI needs to know the other side of the Webbook connection. One has to scroll down again and open the Basic Auth Credentials section. The connection with Vonage is established using basic authentication. Therefore, the following information needs to be provided:
    1. User: Vonage API Key
    2. Password: Vonage API Secret
    3. Webhook: https://messages-sandbox.nexmo.com/v0.1/messages
  7. Click on Save

Provided Message Types

  • Vonage - WhatsApp
    • Provided Message Types
      • Text
      • Media Attachments
      • Location

Text

Use the Text type in the default tab of the SAY Node.

Media Attachments

One can use the default tab of the SAY Node and send, images, videos or audio files. An additonal description can be added by using the Fallback Text.

Location

Use the Text type of the SAY Node and define a data only message (No Text), where the data has to look like the following:

{
  "location": {
    "longitude": -122.747986,
    "latitude": 37.989981,
    "name": "Your Location",
    "address": "Shoreline Highway, CA 1, California"
  }
}

This will be displayed like this:


Comments

0 comments

Article is closed for comments.

Was this article helpful?
0 out of 0 found this helpful