Hey everyone,
I'm evaluating Botpress as weāre looking to integrate it with our learning platform. One key requirement is authenticating users via OAuth2 so we can personalise their content and track their progress within our platform. Iāve wired up most of the flow within a custom integration, but Iām struggling with some state-related aspects that donāt seem to be documented.
User Flow:
1. An organisation installs our bot in their Microsoft Teams or Slack workspace.
2. The bot sends a proactive message to each user when they join the workspace inviting them to log in and link their account.
3. The user follows a link to complete the OAuth2 code flow.
4. The bot stores the access and refresh tokens for the user.
Once authenticated, our integration handles token renewal as needed, allowing users to interact with the bot while tracking their platform-specific progress via our API.
Where I Need Help:
Iām unsure how to manage user-level state during the OAuth flow. Iāve followed [this guide](
https://botpress.com/docs/how-to-setup-oauth-with-github-in-botpress-using-integrations), but it only covers state management at the integration level. My understanding is that I need to store state at either the user or conversation level.
My current planned approach is to use a signed JWT to pass relevant details (e.g., Botpress user ID or conversation ID). Once received via the webhook handler, Iād fetch the user, assign their access/refresh tokens along with any metadata, and trigger an onUserAuthenticated event for the conversation.
Question:
How can I fetch the user or conversation ID from my custom action in Botpress so I can update the state at the end of the OAuth flow?
Any guidance would be much appreciated!