Posts tagged with twilio

I am integrating with the Twilio API to send WhatsApp for Business messages. For the most part, so far everything has been straight forward. However, I foresee the need to be adding new WhatsApp phone numbers and templates in the future. While I have no problem using the Twilio UI to create these new resources, I was curious if there was a way to list the newly added phone numbers and templates in my app via their API. This would help ensure an update to the application wouldn't be needed each time that a new phone number or template is added.

I have found this other question from over a year ago which may indicate that listing phone WhatsApp phone numbers currently isn't possible. However, this question doesn't address listing templates and due to its age I also wanted to reask the community in case anything has changed. Identify Whatsapp phone number when listing Twilio phone number

Thanks!

I need to send a Calendar file (ICS) from the REST Api but i can`t.

Nevertheless, I could send a jpg file. In this article Twilio staff announced that users can send images and videos, but also PDFs, text files, and audio files using the Twilio API for WhatsApp.

This is my call with JPG file that attach the media in a whatsapp message OK:

curl -X POST \ https://api.twilio.com/2010-04-01/Accounts/ACYYYYYYYYYYYYYYYYY/Messages.json \ -H 'authorization: Basic  XXXXXXXXXXXXX' \ -H 'cache-control: no-cache' \ -H 'content-type: application/x-www-form-urlencoded' \ -H 'postman-token: 58fa6aca-3b92-66d4-f675-9906bed37302' \ -d 'To=whatsapp%3A%2BXXXXXXXX&From=whatsapp%3A%2BYYYYYYY&Body=Hola%20probando2&MediaUrl=https%3A%2F%2Flh4.googleusercontent.com%2F-nbafRpNzZAc%2FWjHLp8y3NOI%2FAAAAAAAAAAA%2Fc8CSoPlcgcAazvZFKSU3uYxwo3HZ7FVewCOQCEAE%2Fs128-c-k%2Fphoto.jpg%0A' 

When i substitute MediaUrl path with a txt file path or ics file, the message wasn't attach the file:

for example something like this:

curl -X POST \ https://api.twilio.com/2010-04-01/Accounts/ACYYYYYYYYYYYYYYYYY/Messages.json \ -H 'authorization: Basic  XXXXXXXXXXXXX' \ -H 'cache-control: no-cache' \ -H 'content-type: application/x-www-form-urlencoded' \ -H 'postman-token: 58fa6aca-3b92-66d4-f675-9906bed37302' \ -d 'To=whatsapp%3A%2BXXXXXXXX&From=whatsapp%3A%2BYYYYYYY&Body=Hola%20probando2&MediaUrl=https:%2F%2Faaa.bbb.com%2Fccc%2Fcalendar.ics%0A' 

I am trying to make a WhatsApp bot inspired by the functioning of Discord bots, the bot will work in WhatsApp groups.

I have looked up the official WhatsApp Business API but I am not sure that they will not approve my number as it is just a hobby project and not a proper "business".

There is an alternative though and that is the Twilio WhatsApp API. However, they provide you with a sandbox. I can interact with it in DMs but as the sandbox number is a business account, I cannot add it to a group like discord.

I intend to write a server in python or node.

Can anyone share a solution or workaround? Only if I could add the Twilio number to a group my problem will be solved. Though I am ready to use any other API/Solutions for this.

I am building a Node.js application that receives messages from WhatsApp via Twilio. Sending text messages is not a problem, but when I try to send the current location from the users WhatsApp account I cannot find the coordinates in the request object sent to the server.

This is what I am doing to see what is being sent to the app from Twilio.

app.post('/incoming', (req, res) => { var incomingMessage = req.body.Body; console.log(incomingMessage); }); 

When I share my current location with the app, the request body is empty.

Can anyone shed any light on this or explain how WhatsApp shares a users location within the app?

Thanks.