Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to catch app_mention event #7

Open
Doarakko opened this issue Jan 15, 2022 · 0 comments
Open

Unable to catch app_mention event #7

Doarakko opened this issue Jan 15, 2022 · 0 comments

Comments

@Doarakko
Copy link

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

reproduce

import "https://deno.land/x/dotenv@v2.0.0/load.ts";
import { App, LogLevel } from "https://deno.land/x/slack_bolt@1.0.0/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant