Closed RyzorBent closed 2 years ago
Hello there. I don't think this information is available in msg payload, as per https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components
Hi @guskuma,
i managed to get the name working on my local machine, can i make a pull request on this issue, o have to open a new issue for this feature?
Hello @RyzorBent I'd say you can make a pull request. I do not own this repo but I guess any help is appreciated, right @tawn33y ?
@RyzorBent @guskuma Sure thing! I've reopened the issue. Feel free to open a PR on the same. Here's a guideline on the process: https://gist.github.com/tawn33y/a380c176265d5b060c5c722f1e89d79f
@tawn33y i'm struggling with jest testing, in order to commit changes
perhaps you could do the change on you end? This is the code sniped to get the whatsApp user name
const name = req.body.entry[0].changes[0].value.contacts?.length ? req.body.entry[0].changes[0].value.contacts[0].profile.name : null;
Where do you guys think this property should be? New Message property "fromName"? Or maybe set from into object with wa_id and name properties?
@guskuma ,I think it's best to set it under msg.from.name
since the from
property contains other details of the sender.
@RyzorBent, I can help you with the jest testing. Feel free to share where you are stuck. If unable, happy to take it up for you.
@tawn33y, when i run npm t
i get this 14 passes and 2 fails : which has to do with the verifying the token.
@tawn33y @guskuma Greetings,
Is there an impediment which is preventing this pull request to go through?
Hi @RyzorBent, I'm waiting for @guskuma to address some comments I left on the PR 😊
Hey there! @tawn33y I've made changes to PR, it's ready to be reviewed. Thank you.
@guskuma I've tagged you on the comments you might have missed. Kindly have a look
Fixed by #25
https://github.com/tawn33y/whatsapp-cloud-api/blob/dd73985e97539dd70f4eb74ee256eef63dda2062/src/startExpressServer.ts#L71
Where on the api can i get the name of the sender, When i check the from key it only has cellNumber of the sender but no name
bot.on('message', async (msg) => { console.log(msg.from.name); //undefined console.log(msg.from); //+27xxxxxxxxxx }