2

In normal web application we maintain session by sending UserID/sessionID/tokenID via cookie or as querystring parameter or in HTTP request in header.

How can we have a session when creating a chatbot using facebook messenger? This will be helpful in getting the context of the conversation.

From the documentation there is metadata field in the message object which can be set.

Metadata is a custom string that will be re-delivered to webhook listeners

Can this be used for maintaining the session or is there a better option?

Arun Ghosh
  • 7,634
  • 1
  • 26
  • 38

1 Answers1

0

As CBroe commented, you already have the page-scoped user id on entry.messaging.sender.id property on the receiving JSON request, which can work as a session identifier for each user interacting with your bot.

Community
  • 1
  • 1
Minelli
  • 419
  • 4
  • 6