Twilio usage records for a twilio number - twilio

I would like to know it is possible to get usage records for a twilio number.
It seems the api returns usage for a twilio account only.
https://www.twilio.com/docs/api/rest/usage-records#usage-categories

Twilio developer evangelist here.
Data from the Usage Records API are aggregates for an entire account, not at the phone number level.
You could use the Messages and Calls resources to calculate your own usage though. You'd need to collect all the messages sent to the number and from the number and similarly collect all the calls made to the number and placed from the number.
If you are trying to collect this data in order to charge a customer, then can I recommend using subaccounts instead. Then you can use the usage records on the subaccount and just get the details you need.

Related

Restrict outgoing Twilio SMS messages to Verified Caller IDs

By default, Twilio trial accounts can only send SMS to numbers that are listed as Verified Caller IDs in the Twilio console. These numbers have to be added manually, and require a verification message before they can receive SMS. This is an excellent feature for development, as it prevents accidentally sending SMS to wrong numbers.
My problem, is that I am developing for a client whose account is already out of trial status. I don't want the software in development to be able to send text messages to any number, because there is a risk of sending dev messages to the client's actual customers. However, we need to be able to send to some numbers for testing. Is there any way to turn the trial behavior back on? That is, can we somehow configure Twilio to only allow sending SMS to verfied numbers, even if it is not a trial account?
If this isn't possible, I think I can query the Outgoing Caller IDs resource from my program to verify the recipient number against the list before sending. However, this puts the responsibility back on my development team, and the possibility for mistakes remains. I'd like to be able to block the behavior at the Twilio level.
This behavior is only applied for trial accounts, however I'll pass this feedback on internally.
You'll need to replicate this behavior yourself for your applications using an upgraded account.
As you mentioned, you can query the Outgoing Caller IDs to get the phone numbers you have already verified with Twilio and use that as an accept list.
However, for your use case, you can store and fetch the accept list using whatever way is most convenient for you, like in code, file, database, etc.
Depending on your needs, you could embed this logic directly into your app, or use a single shared library, or create a web API that all other apps have to use to send texts.
Good luck! We can't wait to see what you build!
Update after getting internal feedback.
You can create a new trial account, even with the same Twilio profile, which would give you promotional credits and the same verified Caller ID limits again.
The promotional credit should last you a long time for test scenarios.

Limits send messages using twilio whatsapp API

I want to know what are the limits in Twilio to send mass messages using the WhatsApp API, I want to send notifications of the use of my site to 2,500 numbers but I don't know if that is going to be taken as spam and they will block my account.
Does anyone know if twilio allows me to do this? or what can I do to be able to send notifications to 2,500 numbers without being blocked.
regards!
Twilio developer evangelist here.
Twilio doesn't limit the number of messages you can send, but WhatsApp does while you ramp up your application.
From the docs:
Every new WhatsApp-enabled number is initialized at Tier 1. WhatsApp monitors message volume as well as quality, and will automatically move customers between tiers based on the total number of unique recipients across the past 7 days.
If within the past 7 days, a WhatsApp-enabled Twilio phone number has communicated with 2x the unique recipients of the per-day limit, and maintains a good "quality rating" from WhatsApp, that number will be automatically moved to the next tier on the next day.
The tiers are:
Tier
Limit
Tier 1
Limited to 1,000 unique message recipients per day
Tier 2
Limited to 10,000 unique message recipients per day
Tier 3
Limited to 100,000 unique message recipients per day
You can read more about the different tiers and how WhatsApp calculates a quality rating in the documentation.
Ultimately, you should be able to send 2,500 messages to your recipients, you just have to ramp up to that slowly.

Country specific emergency numbers.

Is it possible to use Twilio to call country specific emergency numbers. I already have the specific numbers (for each country) in my DB. My question is if I can use the sip-trunking emergency calling for dialing emergency numbers in other countries.
Twilio developer evangelist here.
You can place emergency number calls in some situations but there are limitations. you can read more about it here.
In summary, though, to enable emergency calling on a Twilio number you need to do the following:
Configure, validate and associate an address with your Twilio number (from the Numbers tab of your Trunk)
Enable Emergency Calling on that number
Emergency calls (911) will only be routed when Twilio Numbers enabled for Emergency Calling are used as the Caller-ID (SIP From: header). Emergency calls from any other number will be rejected.

Is there something similar to an extension for SMS?

The Scenario:
I have a exclusive mobile chat app. Users can communicate with preselected and know groups of people that don't use the app via an SMS bridge. For that purpose currently each user get's her/his own virtual phone number. SMS for an specific user are sent and received via this virtual number. The SMS are distribute to each member of the group she/he communicates with.
The Problem:
A single receiver can be member of more then one group. In this case, when a receiver (R) responds to an SMS message from the user (U), it is not unambiguously clear wich group the response belongs to. Because the only available information is the sender (R) number and receiver (U) number (virtual) we can not be certain wich of the groups that R belongs to the message came from.
Solution Idea:
The only way I can see to get around this problem is to have U use a different phone number to communicate with each group. Assigning each user many phone phone numbers for that case isn't scalable at all because of the costs. But I also would at least initially like to avoid the complexities of managing a vast number pool that automatically assign numbers to individual communications.
Question:
Is there any way at all to add additional digits to the senders virtual number when sending an SMS? So that when he/she replies to that number, the context is transmitted back to the server
Twilio developer evangelist here.
I'm afraid there isn't anything within SMS that does what you need. You were right when you supposed that U should have a different phone number to communicate with each group.
It's not all bad though, because you can set up which users are in a particular group, you can reuse that number for a completely different group. Here's a good article on scaling number pools for group messaging that might help.

Check users subscriptions?

Is it possible to check how many subscriptions a channel has made?
I have been looking around in Youtubes API without any success.
Note: I am not looking for the amount of subscribers but the amount of subscriptions.
https://www.googleapis.com/youtube/v3/channels?part=statistics&id=ID&key=KEY
The above call returns for example the amount of subscribers which I don't need.
You can use the following request to get the subscriptions made by channel. As you need only count I'm using part=id.
https://www.googleapis.com/youtube/v3/subscriptions?part=id&channelId={YOUR_CHANNEL_ID}&key={YOUR_API_KEY}
Then look for the 'totalResults' attribute to get the count of subscription made by the channel

Resources