Skip to content

Commit

Permalink
slackevents: support metadata in MessageEvent (#1307)
Browse files Browse the repository at this point in the history
Support for receiving metadata when reading conversation history was
first added in PR #1083. This commit extends metadata support to message
events when connected to the Slack WebSocket API.

Signed-off-by: Robert Fratto <[email protected]>
  • Loading branch information
rfratto authored Jul 20, 2024
1 parent 1dfd1df commit b9d4317
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions slackevents/inner_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ type MessageEvent struct {
Blocks slack.Blocks `json:"blocks,omitempty"`
Attachments []slack.Attachment `json:"attachments,omitempty"`

Metadata slack.SlackMetadata `json:"metadata,omitempty"`

// Root is the message that was broadcast to the channel when the SubType is
// thread_broadcast. If this is not a thread_broadcast message event, this
// value is nil.
Expand Down
6 changes: 6 additions & 0 deletions slackevents/inner_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ func TestMessageEvent(t *testing.T) {
"ts": "1355517524.000000"
}
},
"metadata": {
"event_type": "example",
"event_payload": {
"key": "value"
}
},
"previous_message": {
"text": "Live long and prospect."
}
Expand Down

0 comments on commit b9d4317

Please sign in to comment.