Closed elisherer closed 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Solving this with the middleware as you did was the correct way to do it! Thanks for documenting this for others.
While using the
app_mention
event in Slack (vs usingmessage.channel
) (See reference from Slack's docs)"message" events are treated as messages while "app_mention" are treated as events (can be listened to with
controller.on('app_mention')
)Steps to reproduce:
message.channels
andmessage.groups
app_mention
app_mentions:read
scope is usedchannels:history
andgroup:history
scopes.The expected is that when mentioned the bot from any conversation it will trigger the messages API (i.e
controller.hears
) While in actual it doesn't.Context:
Other information
I assume the issue is in
SlackAdapter.processActivity
https://github.com/howdyai/botkit/blob/93650237bd19a8cc8aac379436c30f8bb0116c14/packages/botbuilder-adapter-slack/src/slack_adapter.ts#L644 The assumption that a message must have a 'message' type event is wrong and it should be changed to the following:I managed to make it work adding another middleware just before adding
SlackMessageTypeMiddleware
.SlackAppMentionToMessageMiddleware.js
Usage