Skip to content

Deserializing Webhooks #71

@TonyValenti

Description

@TonyValenti

Hi @mrb0nj -
How do I deserialize a slack event so I can process it? For example, when a message is posted to a slack room, I get the following JSON:

{
  "team_id": "T6Q4W5TQR",
  "api_app_id": "A8DDL8RUY",
  "event": {
    "client_msg_id": "ba299014-e3ba-4817-88f7-01658ee25466",
    "type": "message",
    "text": "test",
    "user": "U6QNA62CC",
    "ts": "1578520850.002100",
    "team": "T6Q4W5TQR",
    "blocks": [
      {
        "type": "rich_text",
        "block_id": "bImul",
        "elements": [
          {
            "type": "rich_text_section",
            "elements": [
              {
                "type": "text",
                "text": "test"
              }
            ]
          }
        ]
      }
    ],
    "channel": "CSEL7QT7S",
    "event_ts": "1578520850.002100",
    "channel_type": "channel"
  },
  "type": "event_callback",
  "event_id": "EvS4FD9M17",
  "event_time": 1578520850,
  "authed_users": [
    "U6QNA62CC"
  ]
}

How do I turn this into the appropriate object?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions