# Socket Mode frames

> The two frames of Socket Mode, field by field, and when the socket closes.

Source: https://slaiky.xyz/docs/reference/socket-mode

Every frame on the socket is JSON, `{ "t": type, "d": data }`. Slaiky sends `app.envelope`; your app sends `app.ack` ([guide](/docs/socket-mode)).

## `app.envelope`

| Field | What |
| --- | --- |
| `envelopeId` | Id of this delivery. Acknowledge it with this id. |
| `type` | `events_api` (an event), `slash_commands` (a command) or `interactive` (a click, a pick, a shortcut, a modal submission or close). |
| `payload` | What happened: the event callback, the command or the interaction, the same body an HTTP app would get. |
| `acceptsResponsePayload` | True for commands and interactions: the acknowledgement may carry the answer (`payload`). |
| `retryAttempt` | 0 the first time; 1, 2… when it is sent again because no acknowledgement came. |

*Slaiky → your app*

```json

{
  "t": "app.envelope",
  "d": {
    "envelopeId": "7f3c0006-5a1e-4c2b-9d6f-1a2b3c4d5e05",
    "type": "events_api",
    "payload": {
      "type": "event_callback",
      "eventId": "7f3c0006-5a1e-4c2b-9d6f-1a2b3c4d5e05",
      "eventTime": 1794312000,
      "appId": "7f3c0002-5a1e-4c2b-9d6f-1a2b3c4d5e01",
      "workspaceId": "7f3c0003-5a1e-4c2b-9d6f-1a2b3c4d5e02",
      "event": {
        "type": "app_mention",
        "message": {
          "id": "7f3c0007-5a1e-4c2b-9d6f-1a2b3c4d5e06",
          "body": "@docsrecorder is the deploy green?",
          "meta": null,
          "files": [],
          "author": {
            "id": "7f3c0008-5a1e-4c2b-9d6f-1a2b3c4d5e07",
            "look": null,
            "name": "Alex Martins",
            "role": "owner",
            "appId": null,
            "isBot": false,
            "title": "Founder · Product",
            "handle": "alex",
            "status": null,
            "agentId": null,
            "timezone": "America/Sao_Paulo",
            "avatarUrl": null,
            "deactivated": false
          },
          "blocks": null,
          "pinned": false,
          "subtype": null,
          "editedAt": null,
          "parentId": null,
          "channelId": "7f3c0009-5a1e-4c2b-9d6f-1a2b3c4d5e08",
          "createdAt": "2026-11-10T12:00:00.000Z",
          "reactions": [],
          "replyCount": 0,
          "replyUsers": [],
          "lastReplyAt": null,
          "alsoInChannel": false
        },
        "threadId": null,
        "channelId": "7f3c0009-5a1e-4c2b-9d6f-1a2b3c4d5e08",
        "channelType": "channel"
      }
    },
    "acceptsResponsePayload": false,
    "retryAttempt": 0
  }
}

```

## `app.ack`

Send it for every envelope, with its `envelopeId`, within 30 seconds. For a command or an interaction, `payload` may carry the answer:

| Argument | Type | Required | What |
| --- | --- | --- | --- |
| `payload.text` | string | no | Up to 40,000 characters. |
| `payload.blocks` | [blocks](/docs/reference/blocks) | no | Up to 50 items, may be `null`. |
| `payload.responseType` | `"ephemeral"` / `"in_channel"` | no |  |
| `payload.replaceOriginal` | boolean | no |  |
| `payload.deleteOriginal` | boolean | no |  |
| `payload.responseAction` | `"errors"` / `"update"` / `"push"` / `"clear"` | no |  |
| `payload.errors` | map of string | no |  |
| `payload.view` | [view](/docs/reference/blocks#views) | no |  |

*your app → Slaiky*

```json

{
  "t": "app.ack",
  "d": {
    "envelopeId": "7f3c0006-5a1e-4c2b-9d6f-1a2b3c4d5e05"
  }
}

```

## Timing

| What | Value |
| --- | --- |
| The URL from `apps.connections.open` works once, for | 30 seconds |
| An envelope without an ack is sent again after | 30 seconds |
| …this many times while you are connected | 3 |
| What you missed while away is sent when you connect, up to this old | 1 hour |
| A command or a click waits this long for the ack to carry its answer | 3 seconds |

## When the socket closes

Turning Socket Mode on or off, or changing the app’s scopes, closes its sockets with code `1012`: connect again (a new `apps.connections.open`) and you are on the new settings. Releases of Slaiky close sockets too. Always reconnect.
