File tree Expand file tree Collapse file tree 2 files changed +40
-5
lines changed
Expand file tree Collapse file tree 2 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -161,11 +161,14 @@ type GridMigrationStartedEvent struct {
161161
162162// LinkSharedEvent A message was posted containing one or more links relevant to your application
163163type LinkSharedEvent struct {
164- Type string `json:"type"`
165- User string `json:"user"`
166- TimeStamp string `json:"ts"`
167- Channel string `json:"channel"`
168- MessageTimeStamp json.Number `json:"message_ts"`
164+ Type string `json:"type"`
165+ User string `json:"user"`
166+ TimeStamp string `json:"ts"`
167+ Channel string `json:"channel"`
168+ // MessageTimeStamp can be both a numeric timestamp if the LinkSharedEvent corresponds to a sent
169+ // message and (contrary to the field name) a uuid if the LinkSharedEvent is generated in the
170+ // compose text area.
171+ MessageTimeStamp string `json:"message_ts"`
169172 ThreadTimeStamp string `json:"thread_ts"`
170173 Links []sharedLinks `json:"links"`
171174}
Original file line number Diff line number Diff line change @@ -103,6 +103,38 @@ func TestLinkSharedEvent(t *testing.T) {
103103 }
104104}
105105
106+ func TestLinkSharedComposerEvent (t * testing.T ) {
107+ rawE := []byte (`
108+ {
109+ "type": "link_shared",
110+ "channel": "COMPOSER",
111+ "is_bot_user_member": true,
112+ "user": "Uxxxxxxx",
113+ "message_ts": "Uxxxxxxx-909b5454-75f8-4ac4-b325-1b40e230bbd8-gryl3kb80b3wm49ihzoo35fyqoq08n2y",
114+ "unfurl_id": "Uxxxxxxx-909b5454-75f8-4ac4-b325-1b40e230bbd8-gryl3kb80b3wm49ihzoo35fyqoq08n2y",
115+ "source": "composer",
116+ "links": [
117+ {
118+ "domain": "example.com",
119+ "url": "https://example.com/12345"
120+ },
121+ {
122+ "domain": "example.com",
123+ "url": "https://example.com/67890"
124+ },
125+ {
126+ "domain": "another-example.com",
127+ "url": "https://yet.another-example.com/v/abcde"
128+ }
129+ ]
130+ }
131+ ` )
132+ err := json .Unmarshal (rawE , & LinkSharedEvent {})
133+ if err != nil {
134+ t .Error (err )
135+ }
136+ }
137+
106138func TestMessageEvent (t * testing.T ) {
107139 rawE := []byte (`
108140 {
You can’t perform that action at this time.
0 commit comments