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

how to get contact number with bot.on event 'contact' ? #27

Closed
frengkys opened this issue Sep 26, 2016 · 2 comments
Closed

how to get contact number with bot.on event 'contact' ? #27

frengkys opened this issue Sep 26, 2016 · 2 comments

Comments

@frengkys
Copy link

frengkys commented Sep 26, 2016

how can i get user phone number with bot on event contact ?
is it a way to get it ?

bot.on('contact', (msg,info)=>{
const id = msg.from.id;
let day = msg.text;
console.log(info);
return bot.sendMessage(
id, 'thanks for contact number'
);
});

@kosmodrey
Copy link
Contributor

Hey, like this:

bot.on('contact', msg => {
  let phoneNumber = msg.contact.phone_number;
  return bot.sendMessage(msg.from.id, `Contact phone number: ${ phoneNumber }`);
});

@frengkys
Copy link
Author

ahhhh, great! Thanks a lot! @kosmodrey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants