Hello,
I am implementing Twitter new Direct Message API, https://api.twitter.com/1.1/direct_messages/events/list.json
I would like to know about following,
1. For “Count” param, its taking max value of given param. If count = 20, it refers to max 20 messages in response and it can be vary i.e. either 14 or 12 or any number < 20 for each API call.
But it sometimes also returning 0 (zero) records in response having “next_cursor” value present.
If “next_cursor” is present then it seems we are having more records to fetch, then why in that API call response events are empty.
For example,
Request Params => {count: 20, cursor: “xxx”}
Response params => empty events array with next_cursor present
2. For some conversations, it difficult to get all messages, as messages are lost in between. If count = 50 then there are chances to get more messages in response,
but if count = 1 (or less than 20) then there might be case to lost few messages from a conversation. Which count value should we keep to retrieve all messages of conversation from last 30 days.
3. Response time of new API seems slower as well.
Any suggestion or guidance will be great help.
Thanks.
Hi @mansishah5544,
1.) Let me look into this a bit more and get back to you.
2.) By “lost messages” are you saying that you are not seeing some DMs at all? If so, I have not been able to recreate this behavior and have not heard of other clients experiencing this.
To answer the second part of question 2, count defaults to 20, but if you set the count to 50 (the maximum value it can be set to) and paginate using the cursor (when it’s present), you’ll ensure that you receive all DMs from the last 30 days with the fewest number of paginations possible.
3.) There have been no updates/changes on our end that should have increased the response time. This seems like it could be network related.
Thanks!
Kevin
Hello Kevin,
Thank you for your reply.
-
By “lost few messages from a conversation", I mean to say that here, if we keep “count”=1 then there might be case that API is returning message list either with empty “events” array and with “next_cursor” or “events” array with one message entry and “next_cursor” if having more messages to retrieve. I will again try to recreate behaviour when I found one message missing from conversation.
-
Ok.
Thanks,
Mansi