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".
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:
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.
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"
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With