Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vcard MMS file name is always "text 1"

Tags:

twilio

When sending a vcard file on an SMS message via Twilio using the mediaUrl option, it shows up on the iPhone with "text 1" next to the file as if "text 1" is the file name.

I have tried renaming the vcard file, using example vcard files, etc. No matter what the files show up as "text 1".

Example vcf

I have tried on iPhone 8 and 10. I have tried bare bones VCF files and full featured ones from Outlook and even example ones online such as http://www.w3.org/2002/12/cal/vcard-examples/john-doe.vcf - No matter what, they show up on iPhone as "text 1".

What can I do to make this be either the phone number or a name?

Edit --- After the comment from @philnash, I was able to add a content-disposition header to the file which now comes back in the headers as follows:

 Content-Disposition: attachment; name="John Doe"; filename="john-doe.vcf" 

Here is a screenshot from Fiddler:
Fiddler screenshot

I also renamed the file to a unique name and tried again in case Twilio or anywhere along the way was caching the old file. The header is there but the message still shows "text 1" on the iPhone.

In case it had something to do with Azure blob storage. I also coded an ASP.Net MVC file action that returns the file with the content dispostion headers - it also shows as "text 1" on iPhone. IIS server

like image 706
ericdc Avatar asked Mar 27 '19 23:03

ericdc


2 Answers

Twilio developer evangelist here.

When Twilio provides the metadata for the MMS it does so based on the Content-Disposition header it gets when requesting the media from the URL you provide. When there isn't one available, it gets set to something generic, like "text 1" in this instance.

To overcome this, you need to set the Content-Disposition response header on the file you are serving. Within this header, you can declare a name and a filename. I haven't been able to test this (I'm not in the US, so can't receive the MMS from Twilio) but I would guess that the name is used, though I would test with filename too.

The header should look a bit like this:

Content-Disposition: inline; name="John Doe"; filename="john-doe.vcf"
like image 75
philnash Avatar answered Sep 23 '22 03:09

philnash


I tested this some as I was having the same issue. It appears once a Vcard has been sent, subsequent sends of the same Vcard result in text 1 being sent for the name of the Vcard. However, for sends to new recipients sends with the name. ...at least from my tests.

like image 23
MSF004 Avatar answered Sep 25 '22 03:09

MSF004