Twilio Showing Wrong Number of Segments - twilio

I am calling Twilio API to fetch messages history. The number of messages and segments returned by the API are different than it shows in the Twilio Usage section. The end point I am calling to fetch the messages list is:
https://api.twilio.com/2010-04-01/Accounts/Account_SID/Messages.json
Please see the stats returned by Usage API for April 14, 2021 in the screenshot below:
You can see in the screenshot that the number of messages returned are 685 while the messages API is returning only 561 messages. Why is there such discrepancy?

The difference has to do with message segments. The /Messages resources and has a field called, "num_segments": "X" - so one message may be made up of multiple segments.
/Messages will be less than the result of the Usage API if you sent a message with more than one segment. A segment is what you are charged for. You can use this tool to see how many segments a message has, or view the results using the field mentioned above, num_segments.
Message Segment Tool

Related

List channel messages $top parameter causes unexpected results

Trying to limit the number of results returned by the List channel messages Graph API. However, when setting $top to e.g. 10, then only 3 messages are returned. When setting it to 30, then 19 messages are returned. Does $top count deleted messages that aren't returned or something like that? Is this a bug?
How do I reliably get the last 10 messages? Do I really have to ask for e.g. 30 and then filter out the rest?
When fetching all users in organization in the C# SDK, I ran into something similar. Running .Distinct() on the result set reduced the number of records to the expected amount.
BaseUrl for client appears to be https://graph.microsoft.com/v1.0

Youtube V3 - LiveChatMessages.list only returns a max of 75 requests

When I try and send the following request:
GET https://www.googleapis.com/youtube/v3/liveChat/messages?liveChatId={..}&part=snippet&maxResults=250key={...}
I only get a max of 75 results returned even though there are more than 75 comments in my livestream. These 75 comments returned are also the 75 newest comments. Setting the nextPageToken with the value in the response above returns an empty set of comments. It's almost like I need a way to view previous pages. Setting maxResults, as I have in the url above does nothing as well. When I add a new comment to the livestream, the first entry of the 75 disappears and the new comment shows up at the bottom of the list.
I am perplexed over why I cannot receive more than 75 comments and why the number 75 as this is not mentioned anywhere in the documentation. Do you guys have any idea whats going on here? I can provide more information as needed.
Having testing the liveChatMessages google youtube-api with the most active rooms I could find and reviewing the documentation I have concluded that when you query the the liveChatMessages api you get the 75 most recent messages ordered from oldest to newest, and the nextTokenId given if added to the next query will return any more recent messages which have been gathered by Google's servers since your first query. I am not sure how to get older messages, it does not seem possible.

Returning Total Number of Messages Sent Via Slack API

Looking for a way to return the total number of messages sent by a team via the Slack API. Browsing the documentation I have not come across a method to do this. Was curious if anyone has a found a way to do something similar.
You probably have to iterate over all channels, groups and users. For a given channel, the search.messages endoint contains the info you need. For instance, using the python Slacker package, we can count the number of messages in #general:
>>> import slacker
>>> token = "yourtoken"
>>> api = slacker.BaseAPI(token)
>>> api.get("search.messages", params={"query": "in:general"}).body["messages"]["total"]
19601
(I leave it to you to iterate over all channels and groups)
There is not API method that provides that information directly, so you will need to calculate that information by iterating of all existing channels.
Basic outline:
Get list of all channels with conversations.list
Get all messages for a channel with
conversations.history. You can directly specify the time period you are interested in with the latest and oldest properties
Sum the counts per channel to get the total
Note that due to Slack's security architecture you will not have access to all private and direct messaging channels. To also get those conversations you will need to collect a token from each of your users and then use those token to get access to everything.

YouTube Analytics API channel: The response has no rows parameter

When using the API for retrieving aggregated metrics for the channel's content the report returns a single row of data that contains totals for each requested metric during the specified date
range.
Here's an API Example link.
Sometimes not even account information is received; the object rows is not present in the response but only columnHeaders, even though the account has the appropriate fields populated (I can see it on the profile available on youtube).
I have made the same observations as jay. Somehow some metrics returned no result rows. But for me it turned out that those missing rows were also not available in youtube's Analytics integration.
As you can see, all "Interaktionen (Interactions)" have 0 values, but the "Geteilte Inhalte (shares)" column differs from the rest. It has no values attached. If you click on the metric you get the following notification
It says: "There is no data available at the moment, chose a diffrent time range or wait some more days".
So for me the API data was always corresponding with youtube's analytics integration.

Get more than 20 last messages

Twitter API documentation says that I can get only 20 last messages (proof link). I'm just wondering if there is any other possibility to get more messages, for example - "all the messages from specific point in time".
I think you can specify count, which can be upto 200 and number of pages as well which allows you to retrieve upto 3200 status messages. And since_id allows you to retrieve messages after that particular message.http://twitter.com/statuses/friends_timeline.xml?count=100&page=5&since_id=23323
Check the parameters in the link you've pasted. There's a parameter count that allows you to get up to 200 messages in one call. If you want more then that you can change since_id parameter value to get even older entries or use page_id.
http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-user_timeline
See the count parameter.
For example:
http://twitter.com/statuses/user_timeline.xml?screen_name=someuser&count=50
That would get 50 messages, instead of the default 20.

Resources