Posts tagged with twilio

My requirement is to send whatsapp message from the web page. So, it should be a single page which will have fields To Mobile number, message and send button.

I found the documentation from facebook that we need to get whatsapp business api for this. I also see some other tools like twilio to achieve this. It is just confusing that, If we can achieve it using whatsapp business api itself, why we require twilio So, My question here is, Is twilio or other third party tools really require to access whatsapp api.

Note: i am planning to do this implementation with node js.

Please clarify.

I am trying to send a pdf through WhatsApp Business API that is stored in google drive, but I am receiving an error " 12300 - Invalid Content-Type " can you help me where am I going wrong also, I want to know how to send a pdf in MediaUrl from my local storage. I tried using Twilio Assets but it's also not working. Here is my code:

 static void Main(string[] args) {     var accountSid = " ";     var authToken = " ";     TwilioClient.Init(accountSid, authToken);     ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;     var mediaUrl = new[] {         new Uri("google drive link")     }.ToList();          var messageOptions = new CreateMessageOptions(         new PhoneNumber("whatsapp:+91XXXXXX"));     messageOptions.From = new PhoneNumber("whatsapp:+XXXXXXXX");     messageOptions.Body = "Hello how are you?";     messageOptions.MediaUrl = mediaUrl;     var message = MessageResource.Create(messageOptions);     Console.WriteLine(message.Body);     Console.ReadLine(); } 

I've been checking the documentation about WhatsApp Business API and Twilio Sandbox for Whatsapp and the only way I see to receive messages configuring URL for my application endpoints.

The thing is management and sec won't approve publishing an endpoint on our network to this matter. The acceptable way for them would be consuming messages from a client in the same way one connects to a mail server or any other service.

Is there any documented alternative to using endpoints to MY application?

Thx

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.