API to get private messages

Hi Jayshree,

You’re able to use the following APIs to get posts from any channel (public, private, or direct) using it’s channel ID:

  • /api/v1/channels/CHANNEL_ID/posts/OFFSET/LIMIT gets the last LIMIT posts in a channel starting OFFSET posts back from the most recent one. So an offset of 50 and a limit of 100 would get you the 50th to 150th most recent posts
  • /api/v1/channels/CHANNEL_ID/posts/TIME gets all posts made in that channel since the given Unix timestamp

Also, so you have some advanced warning, our upcoming release will be replacing the v1 APIs due to some substantial internal changes to our code. You can read more about it here. At this time, the above APIs will be moved to

  • /api/v3/channels/CHANNEL_ID/posts/page/OFFSET/LIMIT
  • /api/v3/channels/CHANNEL_ID/posts/since/TIME