Skip to main content
Aarunya AppsAarunya Apps

Slack Events API TypeScript Types (message event)

TypeScript interfaces for the Slack Events API message event payload. Use these types when building Slack bots and workspace integrations.

Slack Events API — Sample JSON

{
  "token": "Jhj5dZrVaK7ZwHHjRyZWjbDl",
  "team_id": "T061EG9R6",
  "api_app_id": "A0PNCHHK2",
  "event": {
    "type": "message",
    "channel": "C2147483705",
    "user": "U2147483697",
    "text": "Hello, World!",
    "ts": "1355517523.000005",
    "channel_type": "channel"
  },
  "type": "event_callback",
  "event_id": "Ev9UQ52YNA",
  "event_time": 1711928400,
  "authorizations": [
    {
      "enterprise_id": null,
      "team_id": "T061EG9R6",
      "user_id": "U061F7AUR",
      "is_bot": false
    }
  ]
}

Generated TypeScript

export interface Event {
  type: string;
  channel: string;
  user: string;
  text: string;
  ts: string;
  channel_type: string;
}

export interface AuthorizationsItem {
  enterprise_id: null | null;
  team_id: string;
  user_id: string;
  is_bot: boolean;
}

export interface SlackMessageEvent {
  token: string;
  team_id: string;
  api_app_id: string;
  event: Event;
  type: string;
  event_id: string;
  event_time: number;
  authorizations: AuthorizationsItem[];
}

How to use

Copy the TypeScript above into a types.ts file in your project. Import the root interface and use it to type your API responses: const data: SlackMessageEvent = await res.json()

Working with a different JSON payload? Paste any JSON and generate TypeScript interfaces instantly.

Convert your own JSON →

FAQ

How does Slack verify webhook requests?

Slack signs requests with an X-Slack-Signature header. Compute HMAC-SHA256 of 'v0:' + timestamp + ':' + raw body using your app's Signing Secret. The result should match the header. Always check the X-Slack-Request-Timestamp too — reject requests older than 5 minutes.

What is the ts field in the Slack message event?

ts (timestamp) is Slack's unique message identifier — a Unix timestamp with microsecond precision as a string (e.g. '1355517523.000005'). It doubles as the message ID for replies, reactions, and updates. Use ts + channel to uniquely identify any Slack message.

How do I respond to a Slack event without timing out?

Slack expects a 200 response within 3 seconds. Immediately return 200, then process the event asynchronously (queue it or use a background task). For Slack's URL verification challenge (type: 'url_verification'), respond synchronously with { challenge: event.challenge }.

Powered by Aarunya Apps