I have integrated my IBM Watson assistant chatbot with WhatsApp that uses Twilio, and at the moment in Twilio I have a Trial WhatsApp Sandbox Number to be able to test the chatbot within WhatsApp.

Everything works fine till now but I am stuck a bit: I want from within the chat between my chatbot and my user, to automatically retrieve the user's phone number and send it back to IBM chatbot. Is this feasible? Even if I have a trial phone number at the moment?

2

There are 2 best solutions below

3
IObert On

Yes, Twilio will send a couple of parameters to your webhook when you receive a message. If you want to read the phone number, you can read one of these parameters:

  • From

    The phone number or Channel address that sent this message.

  • WaId

    The sender's WhatsApp ID (typically a phone number)

4
Dudi On

IBM chat bot already doest it for you and it can be accessed via ${system_integrations.channel.private.user.id}

see https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-expression-integration-variables