WhatsApp integration: Get value from message event...
# 💻developers
f
Hi I am new here. Have a WhatsApp integration and trying the extract the whatsapp:userid values from the message event payload and put it in a variable. Trying this but do not work: const payload = event.payload const whatsappUserId = payload?.whatsapp?.userid // Store the extracted whatsappUserId in the user variable workflow.varWhatsAppNum = whatsappUserId https://cdn.discordapp.com/attachments/1234765312763625472/1234765315338928211/image.png?ex=6631ec50&is=66309ad0&hm=da81604aa5ccc69f4293f98224b16268c4006f338628a9a34837df9ab1e4eb19&
Appreciate any suggestion 😊
c
are you setting the
workflow.varWhatsAppNum = whatsappUserId
inside of the same code block as the
Copy code
const payload = event.payload
const whatsappUserId = payload?.whatsapp?.userid
?
f
Yes I am
c
I think the problem is in accessing the whatsapUserId which is nested inside
payload>user>tags
can you try the following ?
Copy code
js
const payload = event.payload;
const whatsappUserId = payload.user.tags['whatsapp:userid'];

workflow.varWhatsAppNum = whatsappUserId
console.log(whatsappUserId); // This will output the WhatsApp User ID
m
c
what is the error log your getting inside Botpress ?
m
can you tell me how i can see/test/debug whatsapp chat via botpress? i cannot use the built in debuger or access whatsapp variable, right?
c
hm I'm actually not familiar with this look, where did you take this screen from ? it does give some insights that your
whatsapp user id
might be the wrong
id
or the "syntax" is wrong e.g. it needs to be written different
c
Hi all , i am trying to send whatsapp template to user ,which does not have custom fields i have used start conversation , what i need to enter in User Phone ? , as user phone is the phone number which is currently chatting with chatbot , Please help i am stuck from yesterday https://cdn.discordapp.com/attachments/1234765312763625472/1259017215152488458/image.png?ex=668a26a7&is=6688d527&hm=13c9099efe6ec52e4c01aba5ec66bbdf171acb25ba9059adf02c9e2bc1a2cf4d&