List inbox conversations with q[after] not respecting parameter

Hi there! I’ve been tasked with pulling data from a few different inboxes starting from a certain time.

I’m trying to use the `q[after]` parameter, but it doesn’t seem to work- it just gets ignored completely.


My request is as follows: 


Which, more legibly, looks like this:

after: 1715382074,
limit: 10,
sort_by: date,
sort_order: asc,
q: {
after: 1715382074,
types: [assigned, unassigned, archived, deleted]

As you see, the `after` parameter is included in both the top level params and nested under the `q` param. We’ve tried both ways and they are both ignored.

Because we’re trying to iterate through this chronologically, we have the `sort` to asc, but that’s causing our earliest conversations to be returned. The timestamps on the conversations are starting with: `1698306679.462`, and they’re all about that time. We’ve confirmed those conversations have not been touched/bumped/interacted with recently, and that those are indeed the first conversations for the matching inbox.


Unrelated, but in case we’re taking the wrong approach:

Ideally we’d like to hit a single endpoint to retrieve the conversations for the last 1 hour across 6 of our public conversations. We switched to using the `/inboxes/<id>/conversations` endpoint because it didn’t appear that we could filter by inboxes on the `/conversations` endpoint.


Best answer by jason 13 May 2024, 20:21

View original

2 replies

Userlevel 4
Badge +7


The q param for the /inboxes/:inb_id/conversations endpoint only supports filtering on conversation status. In cases where un-supported parameters are submitted in queries, the API will simply ignore them.


What might be more helpful is the GET /conversations/search/:query endpoint

This allows you to build more complex searches, and returns results sorted by last conversation activity, and does allow before/after search params (which filter for conversations that contain messages or comments created after the minute specified by the Unix timestamp).

An example for your case might be;

GET /conversations/search/inbox:inb_123 after:1715382074

I hope this helps point you in the right direction - Happy to help if you have questions!

Thanks @jason - the `conversations/search` docs seemed to have been down for a few days as I kept getting a 404 when trying to view them. They are back up now. 

It seems there are a lot of nit-picks that the search (and other) endpoints have that aren’t communicated. It would be nice if the endpoints would return the filters that are applied- it would help with development/debugging significantly. 🙂 

That said, I did get it working! That endpoint also only allows you to filter by a single inbox at a time and also just returns nothing if you set `after:0`, but we can at least work with this. 


Thank you so much for your help!