Send contact (vCard) message
Sends a contact card. message.type is contact and message.contacts is a structured array (one or many cards); UnifyPort generates the vCard. Each card requires name; phones[].number, emails[].address, organization, and title are optional. WhatsApp-only for now; an empty contacts array or a card missing name returns 400 invalid_request, and non-WhatsApp providers return 400 unsupported_message_type. Optional opaque WhatsApp reply handle returned after a successful send when the channel provides a referable message identifier. Pass it back unchanged; it is not a parent message id.
https://api.unifyport.ai/v1/messagesHeaders
X-Api-KeyWorkspace API key. The workspace is resolved from this header.
Content-TypeUse application/json when sending a JSON request body.
Path parameters
This endpoint has no path parameters.
Request body
account_idProvider account that sends the message.
toobjectrequiredRecipient target with id and type.
toRecipient target with id and type.
idChannel-side recipient identifier.
typeRecipient type: user, group, or channel.
enum: user, group, channel
messageobjectrequiredNormalized message payload. Text uses message.text; media uses message.url.
messageNormalized message payload. Text uses message.text; media uses message.url.
typeMessage type: text, image, video, audio, document, file, or contact.
enum: text, image, video, audio, document, file, contact
textText content used when message.type is text.
urlPublic media URL used by media message types.
file_urlAlternative media URL supported by file-based provider adapters.
file_keyProvider or storage file reference, when supported.
captionOptional caption for image, video, document, or file messages.
contacts[]object[]One or more structured contact cards used when message.type is contact.
contacts[]One or more structured contact cards used when message.type is contact.
nameContact display name; required for every contact card.
phones[]object[]Phone entries included in the contact card.
phones[]Phone entries included in the contact card.
numberPhone number; required for every phone entry.
typeOptional phone label such as CELL or WORK.
emails[]object[]Email entries included in the contact card.
emails[]Email entries included in the contact card.
addressEmail address; required for every email entry.
typeOptional email label such as WORK or HOME.
organizationOptional organization associated with the contact.
titleOptional job title associated with the contact.
provider_dataobjectProvider-specific options such as Telegram parse_mode or WhatsApp audio seconds and waveform; use top-level reply_to for quoted replies.
provider_dataProvider-specific options such as Telegram parse_mode or WhatsApp audio seconds and waveform; use top-level reply_to for quoted replies.
secondsOptional audio duration in seconds for WhatsApp audio messages; must be zero or greater.
waveformOptional waveform data string for WhatsApp audio messages.
reply_toobjectQuoted-reply target. Copy data.message.reply_token from the inbound webhook into reply_to.reply_token unchanged when supported.
reply_toQuoted-reply target. Copy data.message.reply_token from the inbound webhook into reply_to.reply_token unchanged when supported.
reply_tokenOpaque reply token copied unchanged from data.message.reply_token in the inbound webhook.
mentions[]object[]Members referenced by {{@<id>}} placeholders in text or caption.
mentions[]Members referenced by {{@<id>}} placeholders in text or caption.
idProvider-side member identifier referenced by the matching {{@<id>}} placeholder.
Response body
message_idUnifyPort message identifier (msg_...) for the accepted message.
account_idProvider account this response refers to.
statusAcceptance status; accepted means the message was queued for delivery to the provider.
provider_refProvider-side message reference, once the provider assigns one.
reply_tokenOptional opaque WhatsApp reply handle returned after a successful send when the channel provides a referable message identifier. Pass it back unchanged; it is not a parent message id.
Responses
200Request succeeded. See the example response body.
400The request body, path, or parameters are invalid.
401The X-Api-Key header is missing or invalid.
409The requested operation conflicts with an existing provider account or resource.
500The service encountered an unexpected error.
501The selected provider does not implement this operation.
502The provider adapter or upstream provider could not complete the operation.
Request
curl -X POST https://api.unifyport.ai/v1/messages \
-H "X-Api-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"account_id": "acc_example",
"to": {
"id": "user_example",
"type": "user"
},
"message": {
"type": "contact",
"contacts": [
{
"name": "Jane Doe",
"phones": [{ "number": "+8613800000000", "type": "CELL" }],
"emails": [{ "address": "jane@example.com" }],
"organization": "ACME",
"title": "PM"
}
]
}
}'Response
{
"data": {
"message_id": "msg_example",
"account_id": "acc_example",
"status": "accepted",
"provider_ref": "provider_msg_example",
"reply_token": "<opaque WhatsApp reply handle>"
}
}