Twilio Alphanumeric Sender ID and multiple phone numbers - api

I have difficulties understanding the Twilio API.
It is specified that to send text messages with alphanumeric ID, you need to replace the "From" attribute with the text to be displayed. It works perfectly for me as I have bought only a single number. But it makes me wonder how Twilio selects the phone number to be used to send the text message if you are using an alphanumeric ID with multiple numbers attached to your account.
Regards,

Twilio developer evangelist here.
The message is not actually sent from a number. It's identifying sender is that string that you used. So the messages are not actually attached to any number. You can, in fact, release the number you have in Twilio and still send messages from an alphanumeric ID.
This highlights the drawbacks to an alphanumeric sender ID though. As the message never came from a real number, the receiver cannot respond to it.
So, don't worry about buying more numbers, they won't be a part of messages you send from alphanumeric IDs.

Related

WhatsApp Business api cloud: How do I register a Customer's phonenumber via api?

Currently, I am using WhatsApp Business api cloud on one of my web project, I would like to register a customer's phone number but via api instead through meta, developer platform like following:
"Here is the image to register customer's number in the meta developer platform"
I want do this:
(managing the phone numbers)
but via api, and later of that send the verification code via api as well.
If someone can help me , telling me if that is possible and sharing documentation or the endpoint I would appreciate it very much, I've been looking at the documentation and postman's examples for 2 days without any success.
I'm sorry I didn't share the pictures directly, it is my first question on Stackoverflow
Thanks in advance,
Greetings!
I guess you are using WhatsApp provided a test phone number in From, you need to read this, https://developers.facebook.com/docs/whatsapp/cloud-api/get-started#sent-test-message
Enter the recipient phone number you would like to message in the To field. Ensure the number is correct, and that you want to add it to your list of 5 possible message recipients —as you add phone numbers, follow the prompts on the screen to verify you have access to them. Once this number has been added, it cannot be removed from your list.
Note: This limitation is only for WhatsApp-provided test phone numbers. Real phone numbers that you register do not have a limit on the number of recipients.
You don't need to register receivers' phone numbers if you are using your own real business phone number in the sender's phone number.

Gmail store single copy of mail for both sender and receiver?

If I am sending mail from Gmail to other Gmail user does it store single copy or multiple copy of mail for each?
If its saves single copy what if sender delete his email?
I am creating database schema for this kind of application.
If I am sending mail from Gmail to other Gmail user, does it store single copy or multiple copy of mail for each?
We don't know. And it doesn't matter.
What if sender delete his email?
You can't expect an email to disappear from recepients' inboxes simply because sender deleted it on their end. This is not how email works.
For generic messaging application, when there's no other domains (you control all messages), you can implement such behaviour, if needed. However, some functional requirements of your app may make it very hard. For one-on-one messaging, you can follow advice from Sunil's answer, for example. But what if message has 5 recipients? How many flag columns do you put on messages table? What if message has 200 recipients? Common sense dictates that at least some of information must be duplicated for each recipient and, therefore, is shielded from sender's activity (deletion and whatnot).
How does Gmail do it? Who knows? Who cares? The question is what meets YOUR requirements.
If you are building some kind of messaging system where all messages live on a single database, then it makes sense to just have one copy of each message. You have a separate table or tables to link each message to the relevant users. Like you have a "message" table that holds message text, a "user" table that holds information about each user, and a "user-message" table that links users to messages, containing the user id, message id, a field to identify whether this is the sender or the receiver, maybe other data. If a user deletes a message from his mailbox, you delete the user-message record. Perhaps when the last user-message record for a given message is deleted, you then delete the message.
If there's a reason to keep history, records may not really be deleted but instead marked as deleted.

Login and Verify with only phone number using Nexmo or Twilio

This is an authentication flow, which logs in the user with only the phone number provided (Whatsapp style). The Steps are:
User enters phone number and sent to server.
Server generated 4 digit random key, and save the pair (phone,key) in DB.
Server asks 3rd party SMS service to send key to phone.
SMS service sends message.
User enters the key from sms, and together with phone, sent to server.
Server checks the pair against the DB.
If pair exists, server sends back a token for further calls.
What I am trying to understand is where services like Twilio and Nexmo fit in (or replace parts of the flow).
From what I understand, looking at Nexmo for example,
I can replace steps 2 and 3 with an API call to:
https://api.nexmo.com/verify/
and save the request_id from the response in the DB as pair (phone,request_id).
And now, when the user enters a 4 digit code and sends it back,
I need to call:
https://api.nexmo.com/verify/check/json
providing it with request_id and code.
But where do I get the request_id?
Do the server needs to send it back to the client, the moment it gets it from Nexmo?
I can't see the benefits of using Nexmo here, what will it save me?
Answer to your first question: the request_id is part of the response to the first verify API call. See: https://docs.nexmo.com/index.php/verify/verify
As to what are the benefits of Nexmo here, I believe you have two options:
Generate your own code, use Nexmo to text it to your user, have the user submit the code back to your application, verify code against your own database.
Use Nexmo verify service to generate and send the code to the user, store the returned request_id in your db, have user submit code to your application, call Nexmo verify API to validate code.
In some ways the first option is easier as it is less API calls. However the benefit of the second option, using Nexmo Verify, is that they provide a whole lot more capabilities into the service to fall back to a voice call if SMS isn't working, filter out virtual phone numbers to prevent spam, you don't have to pay for failed SMS attempts, reporting/analytics, etc. etc.
Hopefully that helps a little.

Mailsystem Failure Delivery - Custom subject

When a mail is bounced it has a standard subject.
Is it possible to change with a custom subject or the subject which we gave or with a dynamic subject?
I am building a simple system in php to count all send and not sent mails with the help of bounced mails.
So i need to parse the body of the bounced mail to find the email address to which the mail was not sent.
If there could be any other less overhead option then that could be nice. We can reduce the processing time to parse.
You can send a custom x-mail-id header or use the standard Mail-ID header. You store in a table a map of the id to email addresses.
From there it is simple to find out which email bounced by matching the id to the email address in your table.
That subject could be generated by any server along the path your mail message takes, so I'd say no, you can't change that.

detect that an email is sent to a mailing-list

My application sends mails containing an authentication token. The user which receives the mail clicks on a link and is directed to a webpage. The app recognizes him.
The problem is that sometimes the mail is sent to a mailing list instead of a personal address. Then several people come on the page and override each others' actions.
There are 2 ways I think I could solve this :
detect that the email address is a mailing list before I send the mail
include the final recipient address in the link in the email.
Is any of the 2 possible ?
No.
The recipient can tell if the message came from a mailing list (if the list follows the right guidlines), but the sender can't.
There is no way for the sender to modify the body of an email dynamically based on the final recipient.
David's answer is correct. Though, depending on your context you may find the following idea useful:
You might be able to record the number of clicks per email sent out using that token and just specify a threshold. If the number of times the auth token exceeds it, flag the recipient as a mailing list and exclude them from future mailings.