WhatsApp / SMS integration - Use phone number as v...
# 🤝help
c
Hi there. Is there a way to use the phone number a user is messaging from, as a user variable? Thanks!
f
Yes, try using
event.tags.conversation['whatsapp:userPhone']
c
@famous-zoo-73118 What about SMS, same but replace whatsapp?
Also, where is the documentation to the "event" tags and variables?
Do we need to add an @ or {{}} to the event.tags.conversation['whatsapp:userPhone']? How ca nwe test this?
f
@chilly-church-46005 We don't have a direct SMS integration per se, to which integration you're referring to exactly?
For the tags available you can check the
integration.definition.ts
file of our integrations which are open source and located here: https://github.com/botpress/botpress/tree/master/integrations
For example, for "message" tags just locate the
channels.channel.conversation.tags
node in the integration definition's code, where you'll see the tags available, which you can access through
event.tags.conversation
in the bot, the key is the integration name (defined at the top of the integration definition in the name property) followed by a colon and then followed by the tag name itself.

https://cdn.discordapp.com/attachments/1139237774713684039/1144281183123951636/image.png

So in your bot, if you're using an Execute Code card you can simply use
event.tags.conversation['whatsapp:userPhone']
But if you want to insert this in a text input of a card in the Studio, you need to use it as a
{{ }}
expression, for example:
Copy code
Hello, your number is {{ event.tags.conversation['whatsapp:userPhone'] }}
c
Thanks a lot!
26 Views