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