node.jswhatsapp-cloud-apiwhatsapp-flows

How can we retrieve the user's "wa_id," "wamid," or phone number in a WhatsApp flow?


I have created a WhatsApp flow for exchanging data. When a user sends "Hi" to the WhatsApp number, a message template with a button to start the flow appears.

My issue is that I need the user's phone number, user ID, or any details that WhatsApp provides in the request body when the initial message "Hi" (that is sent by the user) inside the flow(that opens on start flow button click). However, I am unable to find any such information in the request body when the user clicks the "start flow" button.

My backend is built in NodeJS, and I tried storing the user's phone number. However, the problem is that there is no element in the request body that can be used to retrieve or validate the phone number.


Solution

  • If you want to use the user's phone number inside the flow, you could add it as a parameter when you are sending the flow message. You can add parameters to the flow using the field flow_action_payload.data as documented below

    https://developers.facebook.com/docs/whatsapp/flows/guides/sendingaflow#interactive-message-parameters