How do I send a Whatsapp message with twilio using my own number?
Edit: I see that I can only use and send to numbers associated with Twilio. My question was to see if I didn't have to use numbers associated with Twilio, for example, if I were to make a website that can send numbers on WhatsApp, like my own WhatsApp web, how do I do that, as in how do I make a website that can send messages through WhatsApp just like WhatsApp web?
I want to make a python program, that asks for your number when you start it. It then asks for the number you want to send the message to. This code will ultimately be running on android if that helps.
from twilio.rest import Client contact = '' contact = input('Which number do you want to send the message to: ') message = '' message = input('What do you Want to send: ') account_sid = '_' auth_token = '_' client = Client(account_sid, auth_token) #some code to get my number #some code to get my number my_number = #i got my number message = client.messages.create( from_='whatsapp:'+ my_number, body=message, to='whatsapp:' + contact , ) print(message.sid)
So it's the code to get the user's number that I need help with. Another option I've been considering is manually inputting the number and using that (I will add an OTP if I go this route but not rn). Which sounds like the better option?
I'm new to Twilio's APIs so any help would be appreciated.
Twilio developer evangelist here.
To use a phone number with the WhatsApp Business API, regardless of whether you are using Twilio or otherwise, that number needs to be approved by WhatsApp. This means that you cannot just use your own WhatsApp number dynamically.
If you want to see more about numbers that you can use, check out this article on whether you can activate your own number for WhatsApp on Twilio. Also this article on connecting your Twilio number to your WhatsApp account.
Please be aware that once a phone number is registered on the WhatsApp Business API, it cannot be used for WhatsApp Business or the WhatsApp consumer app. A phone number can be upgraded to the WhatsApp Business API, but not downgraded.
https://developers.facebook.com/docs/whatsapp/guides/phone-number/
that is the correct answer. most people do not understand that you can't use your phone number as the number for twilio API. with Twilio (and chatBots in general) you better rent a new WhatsApp number from Twilio or buy a new SIM and register its number as a dedicated WhatsApp API calls. once WhatsApp approve it as an "API" SIM it can no longer be used in Android/iOS Whatsapp client.