Send ics File from Twilio for Whatsapp REST API
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'
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)
in this line: To=whatsapp%3A%2BXXXXXXXX&From=whatsapp%3A%2BYYYYYYY&Body=Hola%20probando2&MediaUrl=https:%2F%2Faaa.bbb.com%2Fccc%2Fcalendar.ics%0A' In the log sms i see the file uploaded but twilio can't send me the file. maybe txt files not supported. Really? It's incredible!
Currently, vcf is not a supported media format but may be in the future.
WhatsApp integration now supports sending vcard/vcf files - twilio.com/changelog/contact-card-support-whatsapp-vcard
Somewhere along the line I mixed up .ics with .vcf :( Sorry, I know you asked about .ics which is a Calendar file, not a contact information card.