Hey folks,
Is it possible to send a welcome message once a user join the channel/group? I couldn't find any reference on this.
Thanks in advance.
You can use service notifications:
bot.on('new_chat_members', (msg) => {
bot.sendMessage(msg.chat.id, 'Welcome');
});
@kamikazechaser new_chat_member over new_chat_participant?
I'm trying to follow the answer but it doesn't work
bot.on('new_chat_member', (msg) => {
bot.sendMessage(msg.chat.id, 'Welcome');
});
@kamikazechaser
new_chat_memberovernew_chat_participant?
@ZamoraFTW try new_chat_participant
@ZamoraFTW @kamikazechaser I've been trying this as well, and it doesn't work new_chat_participant or new_chat_member. Have you found a solution?
new_chat_members
Check This: (https://core.telegram.org/bots/api#message)
Thanks for the link, though I've been testing the one from core telegram - msg. new_chat_members in particular. Is anyone having any success with getting this value? To be clear, I've got if/else statements:
if (msg.new_chat_members != undefined) {
console.log("if statement");
console.log(msg.new_chat_member.username);
console.log(msg.new_chat_member.id);
} else {
console.log("else statement");
console.log("new_chat_members is not defined");
}
but I'm getting polling error.
@NatalieChin80 Your polling error may have nothing to do with the code. It is most likely that your Bot token is incorrect or you are attempting to poll with the same token from a different instance. A network issue may also bring about this error. Also see this example on how to use the field.
@saeedhei Thank you for bringing this into notice. From Telegrams changelog:
Replaced the field new_chat_member in Message with new_chat_members (the old field will still be available for a while for compatibility purposes).
So the new field should be new_chat_members
Most helpful comment
You can use service notifications: