---
title: "How to Create and Send vCards with Go"
description: "Sharing contact details by copying text between apps is ineffective compared to sending a vCard, a structured data format supported by major operating systems and email clients. This tutorial demonstrates creating vCards in Go using the go-vcard package, which handles fields such as formatted name, structured name, street address, telephone number, email address, and URL. The code writes the vCard to a .vcf file with version 4.0 using the go-vcard encoder and constants from the package, exiting on failure. The vCard file is uploaded to Twilio Assets, a static file hosting service bundled with every Twilio account, to make it publicly accessible for the SMS. The Twilio Go SDK sends an SMS with a message body and the vCard URL as a media attachment via the Programmable Messaging API, allowing recipients to open it in their contacts app."
---

# How to Create and Send vCards with Go

[Twilio](https://yomu.fyi/company/twilio) · Matthew Setter · Oct 2, 2026

**Type:** Tutorial

## Summary

Sharing contact details by copying text between apps is ineffective compared to sending a vCard, a structured data format supported by major operating systems and email clients. This tutorial demonstrates creating vCards in Go using the go-vcard package, which handles fields such as formatted name, structured name, street address, telephone number, email address, and URL. The code writes the vCard to a .vcf file with version 4.0 using the go-vcard encoder and constants from the package, exiting on failure. The vCard file is uploaded to Twilio Assets, a static file hosting service bundled with every Twilio account, to make it publicly accessible for the SMS. The Twilio Go SDK sends an SMS with a message body and the vCard URL as a media attachment via the Programmable Messaging API, allowing recipients to open it in their contacts app.

## Approach / What changed

Create a vCard using the go-vcard package, write it to a .vcf file, upload the file to Twilio Assets for public hosting, then send an SMS with the vCard URL as a media attachment using the Twilio Go SDK.

## Takeaways

- vCard is a structured data format for contact information supported by major operating systems and email clients, enabling organized sharing of details like name, phone, and address.
- The go-vcard package in Go can encode vCard files with fields such as formatted name, structured name, street address, telephone number, email address, and URL.
- Twilio Assets provides static file hosting to make vCard files publicly accessible for inclusion as media attachments in SMS messages sent via the Twilio Programmable Messaging API.

## FAQ

### How do you create a vCard file in Go?

Use the go-vcard package to create a vcard.Card object, add fields such as formatted name, address, telephone, email, and URL, then encode it to a .vcf file using vcard.NewEncoder.

### How do you make a vCard file accessible for SMS?

Upload the .vcf file to Twilio Assets in the Twilio Console, set its visibility to Public, and copy the provided URL to use as the media attachment in the SMS.

### How do you send a vCard via SMS using Twilio?

Use the Twilio Go SDK to create a message with the vCard URL as a media attachment via the Programmable Messaging API, setting the sender, recipient, and message body.

**Tags:** [Go](https://yomu.fyi/topic/go), [SMS](https://yomu.fyi/topic/sms), [Twilio](https://yomu.fyi/topic/twilio), [vCard](https://yomu.fyi/topic/vcard)

- Source: [Twilio](https://www.twilio.com/en-us/blog/developers/tutorials/create-send-vcards-with-go)
- Source URL: https://www.twilio.com/en-us/blog/developers/tutorials/create-send-vcards-with-go
- Ingested by Yomu: 2026-10-03T03:00:12.183Z

[Read original post](https://www.twilio.com/en-us/blog/developers/tutorials/create-send-vcards-with-go)
