Is there an API endpoint to see if a phone number is "in service" with our account - twilio-api

I'm new to the Twilio API. I'd like to verify whether a set of phone numbers is "in service" with our account. These are phone numbers like PN0c8XXXX...... and is there a way to send numbers in bulk to be sure that they are associated with our account and in working order? I see a call like this (would Sid be our PN0c8... number?):
GET https://verify.twilio.com/v2/Services/{Sid}
but not clear if this is what we want or if it supports batch mode. Any ideas?

I'm not entirely sure what you mean by verifying a set of phone numbers in "in service" with your account.
However, you can check the details of a phone number in your account using the Incoming Phone Numbers API. If you have a phone number SID, the ID that starts with PN, you can fetch an individual phone number resource by making a request to:
https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{PhoneNumberSid}.json
There isn't an API request that allows you to send multiple SIDs, but you can list all your incoming phone numbers and then check against that list in your own code.
As an aside, the URL you asked about in the question is the Twilio Verify API. Verify allows you to verify user's phone numbers over SMS or voice, and can also perform verification via TOTP, push notification or emails. It's meant for verification or two factor authentication.

Related

Twilio project - modify caller ID name and number

I am trying to figure out a way to send a call to Twilio either using an API or something else (maybe even PSTN call in format: xxx-xxx-xxxx,, yyy-yyy-yyyy where xxx-xxx-xxxx is Twilio number and yyy-yyy-yyyy the “destination number”).
Then have the twilio “relay” that call, sending out pre-programmed business name and number as caller ID to the destination number.
Business case:
Company A is spinning off a different division. When calls are made on behalf of this division, the caller ID cannot say “Company A”. It must say “company B” with the designated #.
Ok to register a diff acc w Twilio for company B if needed.
I don't think that you can pass info like a templated phone number placeholder to Twilio, itself. However, I think that this case might be a good use of the Gateway pattern. Basically, with the Gateway pattern, you create an API that wraps around and adapts to Twilio, itself. Thus, your consumers call your API and they pass dynamic company names and phone numbers as parameters to your API, and your code in the gateway then marshalls that into the body a Twilio request as per Twilio's quick start docs.
Twilio developer evangelist here.
You can set a caller ID when making a phone call. But caller IDs are phone numbers, not text strings, so this is not possible to do. The name that shows up when you receive a call is the name that you set for the contact in your own phone's address book.
I would recommend that if company A starts splitting off and doing different business to company B to just get company A a new phone number.

Telegram bot - importing contacts and request for number

We have a company that has to get in touch with its user over Telegram, we've been thinking a lot and this is what came to my mind, I just want to know is it really possible to do such thing or not.
So basically we made an account to be our customer care service where people can tell us what their problem is and stuff. We also gathered all of our users Phone numbers + first and last name into a xlsx file during their first ever purchase.
Now this has to be done:
Is it possible to import all the phone numbers + names into a bot, and then whenever we receive a message from a customer on our customer care account, we forward their message to the bot, and it gives us their phone number.
This is technically possible for the account itself (not bot) but as Telegram has a limitation for number of contacts (I think it's 10k per acc), we can't do it. (We have over 50k users)
Is that clear or more explanation is needed.
P.S: My question was if it's possible to create a bot to be able to receive a message from a customer and return their number. (We already have their number so it's just like a quick search)
Additional info: If telegram did not have such limitation for number of contacts, we could simply add 50k contacts with a vcf file (on a phone) and see their number when they message us but since there is a limitation, we just want the bot to do this job for us but it has to able to give us their number too.
It will require a lot of work to setup, but it could be done.
Telegram gives every user a userid, but it won't tell you the phone number given that user id. So you have to get the userid by asking Telegram "what userid has phone number xyz" for every user and storing that information.
While it is possible to use the bot api and send a contact with each number to get the user_id of that user, the bot api is rate limited, and 50k users will either trigger that rate limit or will require some time.

Use both email and phone number in Account kit together

I am working with facebook Account Kit. During signup, I want the user to verify both email and phone so they can login with either of them. But currently facebook lets only phone or only email for one user id. Is there a way I can use both for a single user?
No, there is currently no way for an email and a phone number to share the same user ID. You would need to handle this yourself by using only one of these values as the user ID, and having an association between these 2 values.

AWS Lambda & Cognito - Updating user phone number attribute without sending an SMS

I am working on an iOS app using Amazon Web Services and I am setting up a user data base using the Cognito Userpool. During the sign up process, if a user enters the wrong phone number by mistake and in result isn't receiving a verification code, I am trying to allow them to then enter a new phone number, and update their phone number user attribute. Right now I am using a Lambda function which uses the AdminUpdateUserAttribute function, which is then connected to a APIGateway which allows me to run it from XCode. The function itself works and it successfully updates the phone number attribute.
Problem
The problem that I am running into though, is that after the phone number attribute has been updated with the Lambda function, a verification code is automatically sent to the newly updated phone number via SMS. The verification code is weird though because when I use that code to confirm the user, it doesn't work. Meaning that code is invalid for confirmation purposes. But if I use the Resend Confirmation Code function it will then send a valid confirmation code to the newly updated phone number.
Question
So I guess the questions I have are:
How can I prevent the automatic SMS from sending after I update the user's phone number attribute?
Or, is there a way I can use the verification code that is automatically sent as a confirmation code?
Thank you in advanced.

User's phone number in messenger bot?

Is it possible to get user's phone number from web hook sent by messenger bot when a user initiates a chat?
I need to check if a user by phone number is existing in my database or not.
No you cannot do it, check it.
https://developers.facebook.com/docs/messenger-platform/user-profile
One system you can apply, when anyone enter the bot first time check the psid in this user exist in db or not, so when if not exist, send a message "Please enter your number", if number match the db then update psid.
So need to access user phone number once time in chatbot lifetime,because when after verification you again insert the chatbot, it shows you verified because your psid then exist.