Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where to get name of the sender #21

Closed
RyzorBent opened this issue Aug 7, 2022 · 13 comments · Fixed by #25
Closed

Where to get name of the sender #21

RyzorBent opened this issue Aug 7, 2022 · 13 comments · Fixed by #25
Assignees
Labels
enhancement New feature or request

Comments

@RyzorBent
Copy link

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
}

@guskuma
Copy link
Collaborator

guskuma commented Aug 7, 2022

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

@tawn33y tawn33y closed this as completed Aug 8, 2022
@RyzorBent
Copy link
Author

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?

@guskuma
Copy link
Collaborator

guskuma commented Aug 8, 2022

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 ?

@tawn33y tawn33y reopened this Aug 8, 2022
@tawn33y
Copy link
Owner

tawn33y commented Aug 8, 2022

@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

@RyzorBent
Copy link
Author

@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;

@guskuma
Copy link
Collaborator

guskuma commented Aug 9, 2022

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?

@tawn33y
Copy link
Owner

tawn33y commented Aug 9, 2022

@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.

@RyzorBent
Copy link
Author

@tawn33y, when i run npm t i get this 14 passes and 2 fails : which has to do with the verifying the token.

Screenshot 2022-08-12 at 08 01 02

@guskuma guskuma self-assigned this Aug 16, 2022
@guskuma guskuma added the enhancement New feature or request label Aug 16, 2022
@RyzorBent
Copy link
Author

@tawn33y @guskuma Greetings,

Is there an impediment which is preventing this pull request to go through?

@tawn33y
Copy link
Owner

tawn33y commented Aug 22, 2022

Hi @RyzorBent, I'm waiting for @guskuma to address some comments I left on the PR 😊

@guskuma
Copy link
Collaborator

guskuma commented Aug 23, 2022

Hey there! @tawn33y I've made changes to PR, it's ready to be reviewed. Thank you.

@tawn33y
Copy link
Owner

tawn33y commented Aug 25, 2022

@guskuma I've tagged you on the comments you might have missed. Kindly have a look

@tawn33y
Copy link
Owner

tawn33y commented Aug 26, 2022

Fixed by #25

@tawn33y tawn33y closed this as completed Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants