DEV Community

Cover image for How to Build a Whatsapp Bot: Build Whatsapp as a channel for Amazon Connect using Lex
amlan
amlan

Posted on

How to Build a Whatsapp Bot: Build Whatsapp as a channel for Amazon Connect using Lex

Recently I have been playing around with whatsapp API to learn some aspects of it. So I thought what better way to learn more about the API than using that in an actual project. So I planned to build a Whatsapp bot which uses Whatsapp API and Amazon Lex, Amazon Connect. This bot enables communication to Amazon connect via a new custom communication channel namely Whatsapp. Basically this will enable someone to communicate to Amazon connect agent simply from whatsapp. I think this will also provide a good learning for someone to use Amazon Lex and Amazon connect APIs. Here I will explain the overall workings of the bot and the deployment approach for various components of the whole bot architecture. This bot involves the below components using which the whole architecture is built:

Whatsapp API (via Twilio API)

  • Amazon Lex
  • Amazon Connect

A demo of the bot can be found at below links:

https://www.youtube.com/watch?v=xZoO-9nlnF0&feature=youtu.be

https://www.youtube.com/watch?v=0MHHr4lnzGo&feature=youtu.be

More details about this here: https://amlanscloud.com/whatsappbot/

Top comments (1)

Collapse
 
ilwerkart9107 profile image
Ilwer Kart

Building a WhatsApp bot using Amazon Connect and Lex is a multi-step process. Here are the high-level steps:

Set up an Amazon Connect instance: You need to create an Amazon Connect instance to use it as a channel for your WhatsApp bot. You can follow the instructions on the Amazon Connect documentation to set up your instance.

Set up a Lex bot: Once you have an Amazon Connect instance set up, you can create a Lex bot to handle the conversational flow of your WhatsApp bot. You can use the Lex console or the Lex API to create your bot.

Integrate Amazon Connect and WhatsApp: To use WhatsApp as a channel for your Amazon Connect instance, you need to integrate them. You can use a third-party integration service like Twilio or a custom integration using the WhatsApp Business API.

Train your Lex bot: You need to train your Lex bot to understand the intents and entities that your users will use to interact with your WhatsApp bot. You can use the Lex console to create sample utterances and slot types for your bot.

Test your bot: After you have set up your Amazon Connect instance, Lex bot, and WhatsApp integration, you can test your bot to make sure it works as expected. You can use the Amazon Connect Contact Control Panel or a third-party tool like Chatvisor to test your bot.

For example, if a user asks "What is ogwhatsapp?", your bot can respond with a predefined answer about ogwhatsapp apk. You can also add other keywords that you think your users might use to interact with your bot.