Whatsapp setup using Nexmo

1. Introduction 

WhatsApp Messenger is a freeware, cross-platform messaging, and Voice over IP service. The fastest-growing messaging platform and MyBOT allows you to use this platform for your bot. MyBOT has its integration with Nexmo and you can deploy your MyBOT bot on Whatsapp using this integration.

2. Steps to Configure Nexmo For JWT Based setup (Sandbox environment)

2.1 Setup in MyBOT

  1. Login to MyBOT and go to the bot in which you want to set up Whatsapp using Nexmo JWT
  2. Click on Deploy and go to the Whatsapp channel.
  3. Click on Deploy and select the provider – Nexmo
  4. Enter Phone Number(without + and no space between them), JWT and Client URL(https://sandbox.nexmodemo.com/v0.1/messages/) in the boxes after selecting JSON Web Token in the dropdown

2.2 Setup in Nexmo

  1. Give the inbound webhook URL and the status webhook URL to Nexmo.
    [Note: You need to update the keyword $provider to Nexmo]
  2. Nexmo will provide us with the JWT token and Keyword to connect with this bot.
  3. Login into https://sandbox.nexmodemo.com/ui/ using email and JWT provided
  1. Click on edit and we will have a popup with details on the setup
  1. Update the Inbound URL and status URL here.

3. Steps to Configure Nexmo for ApplicationId Based setup (Production Environment)

3.1 Setup in MyBOT

  1. Login to MyBOT and go to the bot in which you want to set up WhatsApp using Nexmo JWT
  2. Click on Deploy and go to the Whatsapp channel.
  3. Enter Phone Number(without + and no space between them), Client URL(https://api.nexmo.com/v0.1/messages) in the boxes after selecting Application Id in the dropdown.
  4. Application Id and privateKey we will get from https://developer.nexmo.com (check below for steps)

3.2 Setup in Nexmo

  1. Login to  https://developer.nexmo.com
  2. Go to Your application under Messages and Dispatch. 
  3. Select your API key from the dropdown.
  4. Create a new application if we have not created any application till now. 
  5. If we already have an application created like we can see ROXY in the above screenshot. Click on that. It will redirect you to this screen
  6. Click on the edit option.
  7. Click on edit or Create a new application will take you to a screen similar to :
  8. We can get the Private key from here, which we need to update in MyBOT for setup. (Generate public and private key)
  9. We have the fill the details like Name, URLS(Inbound and Statushere.[Note : The URL present in MyBOT will be like, https://mybot.cbots.live/$provider/webhooks/a0/f63d7fda19754e49. Here we need to change $provider to Nexmo. So the URL that we update on Nexmo should be: https://mybot.cbots.live/nexmo/webhooks/a0/f63d7fda19754e49]
  10. Application Id will be generated after we save this, which we need to update in MyBOT

3.3 Sending a PDF file via Nexmo

You can now send PDF files as-is on Whatsapp using MyBOT, instead of sending the file URL/link. So for internal files or for those files whose URL cannot be shared with the end-users, you can leverage the MyBOT Whatsapp integration with Nexmo to send the PDF files as-is. You will need to use the JSON API node or Script node to send the file. If you would like to send internal files to external end-users, you will need to use the MyBOT C2E module.

Script

process({“data”: {
“file_url”: ” (PDF URL) “,
“type”: “file”,
“file_caption”: “( File Name )”
}});

The following script being used in the Script node will allow the users to view the PDF file in a tile format.

Was this article helpful?

Related Articles

Leave A Comment?