slack-bolt icon indicating copy to clipboard operation
slack-bolt copied to clipboard

Unable to catch `app_mention` event

Open Doarakko opened this issue 3 years ago • 0 comments

If you use the same token and bolt.js, it works fine.

reproduce

import "https://deno.land/x/[email protected]/load.ts";
import { App, LogLevel } from "https://deno.land/x/[email protected]/mod.ts";

const app = new App({
  appToken: Deno.env.get("SLACK_APP_TOKEN"),
  token: Deno.env.get("SLACK_BOT_TOKEN"),
  socketMode: true,
  logLevel: LogLevel.DEBUG,
  convoStore: false,
});

app.event("message", async ({ event, say }: { event: any; say: any }) => {
  console.log(event);
  await say("ok");
});


app.event("app_mention", async ({ event, say }: { event: any; say: any }) => {
  console.log(event);
  await say("shut up");
});

await app.start({ port: 3000 });
console.log("🦕 ⚡️");
deno run --no-check=remote --allow-read --allow-env --allow-net app.ts

result

When I send @app-name in Slack.

ok

log

type is message.

[DEBUG]  socket-mode:SocketModeClient:0 received a message on the WebSocket
[DEBUG]  socket-mode:SocketModeClient:0 calling ack events_api
[DEBUG]  socket-mode:SocketModeClient:0 send() in state: connected,ready
[DEBUG]  socket-mode:SocketModeClient:0 sending message on websocket: {"envelope_id":"57d95ce2-9e94-4664-8c35-5f5192ea4287","payload":{}}
{
  client_msg_id: "c0362a9b-ca77-4050-9559-f72889726d3a",
  type: "message",
  text: "<@U02U6959XR8>",
  user: "UC734HMC4",
  ts: "1642244168.013100",
  team: "TC7E8TQKX",
  blocks: [ { type: "rich_text", block_id: "YUA", elements: [ [Object] ] } ],
  channel: "C02JD5ATBH7",
  event_ts: "1642244168.013100",
  channel_type: "channel"
}
[DEBUG]  web-api:WebClient:0 apiCall('chat.postMessage') start
[DEBUG]  web-api:WebClient:0 will perform http request
[DEBUG]  web-api:WebClient:0 http response received
[DEBUG]  socket-mode:SocketModeClient:0 received a message on the WebSocket
[DEBUG]  socket-mode:SocketModeClient:0 calling ack events_api
[DEBUG]  socket-mode:SocketModeClient:0 send() in state: connected,ready
[DEBUG]  socket-mode:SocketModeClient:0 sending message on websocket: {"envelope_id":"ac93b96b-8f94-4c99-9e0a-c356aa4ee5ee","payload":{}}
[DEBUG]  socket-mode:SocketModeClient:0 received a message on the WebSocket
[DEBUG]  socket-mode:SocketModeClient:0 calling ack events_api
[DEBUG]  socket-mode:SocketModeClient:0 send() in state: connected,ready
[DEBUG]  socket-mode:SocketModeClient:0 sending message on websocket: {"envelope_id":"cb47e532-cbbf-44a7-8842-e3ec7e201f94","payload":{}}

manifest.yml

_metadata:
  major_version: 1
  minor_version: 1
display_information:
  name: pedri
features:
  bot_user:
    display_name: pedri
    always_online: true
oauth_config:
  scopes:
    bot:
      - app_mentions:read
      - chat:write
settings:
  event_subscriptions:
    bot_events:
      - app_mention
  interactivity:
    is_enabled: true
  org_deploy_enabled: false
  socket_mode_enabled: true
  token_rotation_enabled: false

Doarakko avatar Jan 15 '22 11:01 Doarakko