我正在使用botkit来开发slack应用程序。我想知道如何向安装松弛应用程序的用户发送直接消息到他们的团队。
发布于 2017-04-04 23:36:56
您可以使用controller.on('event_name', function (bot, message) { ... })
处理程序来挂钩不同的事件。docs中列出了Slack事件的完整列表。在我看来,你可以使用team_join事件。当新用户接受加入团队的邀请并登录团队时,会触发此事件。
示例:
controller.on('team_join', function (bot, message) {
bot.api.chat.postMessage({channel: response.channel.id, text: 'Welcome', as_user: true}, function (err, response) {
// Process postMessage error and response
})
})
https://stackoverflow.com/questions/42674383
复制相似问题