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 send only once one message? #134

Closed
sgaseretto opened this Issue Dec 28, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@sgaseretto
Copy link

sgaseretto commented Dec 28, 2017

When I run the examples for messenger, once I send something to the bot, it starts spamming the same thing until I stop the server, how do I send a message only once and wait for the user to respond?
Here is an example of what I'm talking:
img_3630

@wtflink

This comment has been minimized.

Copy link
Member

wtflink commented Dec 28, 2017

Seems like your bot keep receiving the "message_echoes" event.
Set your webhook properly or filter onEcho event to stop the bot from self responding.
You can also check the official webhook setting documents for more info.
ref: https://developers.facebook.com/docs/messenger-platform/webhook

@sgaseretto

This comment has been minimized.

Copy link
Author

sgaseretto commented Dec 28, 2017

Thanks a lot, it was the "message_echoes" event

@sgaseretto sgaseretto closed this Dec 28, 2017

@chentsulin

This comment has been minimized.

Copy link
Member

chentsulin commented Dec 29, 2017

Or you can filter echo events explicitly in the handler:

bot.onEvent(async context => {
  if (!context.event.isEcho) {
    await context.sendText('Hello World');
  }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment