Skip to content

Missing fields in AppMentionEvent #961

@phoebelilius

Description

@phoebelilius

AppMentionEvent may have attachments, if referenced by another bot.
Example payload:

{
    "api_app_id": "xxxx",
    "authorizations": [
        {
            "enterprise_id": "xxx",
            "is_bot": true,
            "is_enterprise_install": false,
            "team_id": "xxx",
            "user_id": "xxx"
        }
    ],
    "enterprise_id": "xxx",
    "event": {
        "attachments": [
            {
                "blocks": [
                    {
                        "block_id": "HNku",
                        "text": {
                            "text": "My test event CC <@MYBOTID>",
                            "type": "mrkdwn",
                            "verbatim": false
                        },
                        "type": "section"
                    }
                ],
                "color": "#29AF7B",
                "fallback": "[no preview available]",
                "id": 1
            }
        ],
        "bot_id": "xxx",
        "bot_profile": {
            "app_id": "xxx",
            "deleted": false,
            "icons": {
                "image_36": "https://slack-files2.s3-us-west-2.amazonaws.com/avatars/xxx"
            },
            "id": "xxx",
            "name": "xxx",
            "team_id": "xxx",
            "updated": 1562687282
        },
        "channel": "xxx",
        "edited": {
            "ts": "1628260114.000000",
            "user": "xxx"
        },
        "event_ts": "1628259917.003000",
        "team": "xxx",
        "text": "",
        "ts": "1628259917.003000",
        "type": "app_mention",
        "user": "xxx"
    },
    "event_context": "xxx",
    "event_id": "xxx",
    "event_time": 1628259917,
    "is_ext_shared_channel": false,
    "team_id": "xxx",
    "token": "xxx",
    "type": "event_callback"
}

type AppMentionEvent struct {
Type string `json:"type"`
User string `json:"user"`
Text string `json:"text"`
TimeStamp string `json:"ts"`
ThreadTimeStamp string `json:"thread_ts"`
Channel string `json:"channel"`
EventTimeStamp json.Number `json:"event_ts"`
// When Message comes from a channel that is shared between workspaces
UserTeam string `json:"user_team,omitempty"`
SourceTeam string `json:"source_team,omitempty"`
// BotID is filled out when a bot triggers the app_mention event
BotID string `json:"bot_id,omitempty"`
}

Currently using ParseEvent can only parse inner events (AppMentionEvent) in the format:

{
    "api_app_id": "xxx",
    "authorizations": [
        {
            "enterprise_id": "xxx",
            "is_bot": true,
            "is_enterprise_install": false,
            "team_id": "xxx",
            "user_id": "xxx"
        }
    ],
    "enterprise_id": "xxx",
    "event": {
        "bot_id": "xxx",
        "channel": "xxx",
        "event_ts": "1628260061.003900",
        "subtype": "bot_message",
        "text": "CC <@BOTID> test",
        "ts": "1628260061.003900",
        "type": "app_mention",
        "username": "xxx"
    },
    "event_context": "xxx",
    "event_id": "xxx",
    "event_time": 1628260061,
    "is_ext_shared_channel": false,
    "team_id": "xxx",
    "token": "xxx",
    "type": "event_callback"
}

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions