slack api - Look a message's text from events api response -
i'm using slacks events api , have setup subscription reactions_added event. when reaction added message, slack send me post body details of dispatched event described here.
the problem i'm having want details, text
of message users have reacted can parse/store etc specific message. assumed message return type of uuid respond callback , text, i'm find difficult specific message.
the endpoint see available channels.history
, doesn't seem give me granularity i'm looking for.
so tl;dr is: how via slacks api, messages text sent events api? give information have event_ts, channel , message ts thought enough. i'm using ruby slack-api gem fwiw.
you can indeed use method channels.history
(https://api.slack.com/methods/channels.history) retrieve message public channel . reaction_added
dispatched event includes channel id , timestamp of original message (in item
) , combination of channelid + timestamp should unique.
be careful use correct timestamp though. need use item.ts
not event_ts
full example dispatched event docs:
{ "token": "z26ufbvr1xhjedhe1oqio6t8", "team_id": "t061eg9rz", "api_app_id": "a0ffv41kk", "event": { "type": "reaction_added", "user": "u061f1eur", "item": { "type": "message", "channel": "c061eg9sl", "ts": "1464196127.000002" }, "reaction": "slightly_smiling_face" }, "event_ts": "1465244570.336841", "type": "event_callback", "authed_users": [ "u061f7aur" ]}
so calling channels.history
these values set should work:
- latest = item.ts value
- earliest = item.ts value
- inclusive = 1
- channel = item.channel value
if want messages private channel need use groups.history
.
Comments
Post a Comment