Search code examples
facebook-messengerfacebook-messenger-bot

Is there a way to identify the "replied to" message with Messenger API


  1. My Messenger bot asks a question:

"What is your favorite color ?"

  1. My webhook receives a reply message:

"Red"

How can the webhook identify what was the question ? Do I need to store something like the "lastQuestionSent" in the database ?


Solution

  • You could keep track of it in a session for that user. Maintaining sessions will pay dividends down the line.

    You could include a reference to the question in your callback payload.