Bot Framework User Identification

2019-02-21 05:09发布

问题:

How does bot framework identify the user so it knows to go and grab correct state data? It identifies user correctly when same channel is used, even on different machines. Does it user IP address or something similar?

回答1:

It is based on the Id property of the user + the channel Id. This user Id depends on the channel: each channel has a specific format of user Id, hence those 2 fields.

Examples:

  • Webchat: by default is userid but can be changed: user: { id: 'userid' },
  • Emulator: user ID is always set to default-user
  • Facebook Messenger: the user ID is a PSID (Page Scoped ID) of the user
  • Slack: the user ID is made of the concatenation of several parameters: Slack's Team ID, Slack's channel ID, and Slack's User ID
  • SMS: it's the phone number
  • Email: it's the email address
  • etc