我正在使用botkit和nodejs开发一个松弛的bot。当消息发布到bot时,例如“ connect to a salesforce org”,将启动salesforce oauth流。 oauth流程或用户与bot的交互都没有问题,但是我正在尝试从数据库(MongoDB)中保存收到的消息中的oauth回调结果以及team_id。我无法找出一种方法来获取我已使用Express处理回调的快速路由中的团队ID值。
我尝试使用事件发射器,但那里也没有运气。
这是一些示例代码
controller.hears(['connect to a salesforce org'], 'direct_message', (bot, message) => {
// start oauth process by opening the auth url where user will be asked to sign in and to allow/deny access to the app
// the team id that I want to save in the database is available here as message.team_id
});
// if user allows access then this route is invoked
app.get('/sfauth/callback', (req, res) => {
// here I can establish the connection (using JSforce) and successfully save the required values in the database
// the only missing value is the team_id from the message that initiated the auth process
});