Skip to content

lex v2 + twillio

0

Problem statement: I want to access Lex V2 chatbot with response card buttons on WhatsApp.

I created a Lex V2 bot, and created a channel for Twilio. Connected Twilio through WhatsApp, and able to use my bot fine for plaintext responses. But in my bot, I also return a response card with buttons for one of the slot values. This works fine on AWS console, but when I run it through Twilio, it doesnt work. The response card isnt create by lambda,

asked a year ago152 views

1 Answer
0

Integrating Amazon Lex V2 with Twilio for WhatsApp messaging is possible, but there are some limitations when it comes to response cards with buttons.

While you've successfully set up the integration for plaintext responses, the issue you're experiencing with response cards is due to the differences in how various platforms handle rich message formats.

Amazon Lex V2 supports response cards with buttons when tested directly in the AWS console. However, when integrating with messaging platforms like Twilio for WhatsApp, the support for rich message formats may be limited.

WhatsApp, in particular, has its own message format and doesn't directly support Lex's response card format. This is why you're not seeing the buttons when using the bot through Twilio and WhatsApp, even though they appear in the AWS console.

To work around this limitation, you might need to modify your Lambda function to handle the conversion of Lex response cards into a format that WhatsApp can understand. This could involve parsing the response card information and reformatting it as a list of options or using WhatsApp's template messages.

Keep in mind that the exact implementation will depend on the specific requirements of your bot and the capabilities of WhatsApp's messaging API. You may need to consult Twilio's documentation for WhatsApp integration to find the best way to represent your bot's response cards in a WhatsApp-friendly format.

In summary, while Lex V2 and Twilio integration works well for text-based conversations, additional development work is required to support rich message formats like response cards when using WhatsApp as the messaging channel.
Sources
Integrating an Amazon Lex V2 bot with Twilio SMS - Amazon Lex
Integrating an Amazon Lex V2 bot with a messaging platform - Amazon Lex
Step 2: Integrate the Twilio message service endpoint with the Amazon Lex V2 bot - Amazon Lex

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.