API Get latest messages from a channel

What api url can I use to get the most recent messages from a channel? I know I can use a outgoing webhook to get messages as they are sent but I would like to retrieve previous messages like the last 5 sent. Slack has a channel.history api method, however this did not seem to work here.

Documentation of the possible web service api urls would be really helpful. I checked the github logs and there doesn’t seem to have been any progress here for 2 months.

You have api/v1/channels/<channel id>/posts/<offset>/<limit> which will get a set number of posts (specified by <limit>) from the channel, offset from the latest by a set number (specified by <offset>).
For example, api/v1/channel/<channel id>/posts/5/10 would get 10 posts, skipping over the latest 5.

There is also api/v1/channels/<channel id>/posts/<UNIX timestamp> that will get all posts created or modified since the date specified.

If you want live updates, its better to set up a WebSocket connection. Then you will get near-instant notifications of new and edited posts, among other things. Let me know if that’s what you want and I can give a quick rundown of it.

1 Like

how to get channel_id?