1
votes

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'
1

1 Answers

1
votes

Below is a list of supported file types, I don't see the files you are trying to send as supported types for the underlying WhatsApp Business API.

Sending and Receiving Media with WhatsApp Messaging on Twilio (Beta)