Transactional — One-off Send¶
Send email and/or SMS directly to a set of recipients without first creating a message object. Contacts are automatically created in the associated contact list if they do not exist.
Note
This endpoint requires Content-Type: application/json. Calls with application/x-www-form-urlencoded return an "Unimplemented" error.
Endpoint¶
POST /transactional/<transactional>/transaction
POST /transactional/<transactional>/transaction¶
Payload¶
The payload must be a JSON object sent with Content-Type: application/json.
| Field | Type | Description |
|---|---|---|
recipients |
array | Array of recipient objects. Each email/telephone may appear at most once. |
template |
object (optional) | Shared email template applied to all recipients who do not provide their own payload. |
Recipient object:
| Field | Type | Description |
|---|---|---|
email |
string (optional) | Recipient email address |
telephone |
string (optional) | Recipient telephone number |
externalreference |
string (optional) | Your system's reference ID, returned unchanged in delivery callbacks |
payload.email |
string (optional) | Complete email HTML for this recipient. Overrides the shared template. |
payload.sms |
string (optional) | SMS text for this recipient. Overrides the shared template. |
At least one of email or telephone must be present per recipient.
Returns: The transactional entity, plus created (contacts newly added to the list) and nonsubscribed (contacts skipped because they unsubscribed).
Example — send using the configured message template:
curl -u "username:api_key" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"recipients": [
{
"email": "recipient@example.com",
"telephone": "351910000001",
"externalreference": "order-123"
}
]
}' \
https://app.duo.pt/transactional/{transactional_id}/transaction
Example — send with per-recipient custom payload:
curl -u "username:api_key" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"recipients": [
{
"email": "recipient@example.com",
"telephone": "351910000001",
"externalreference": "order-456",
"payload": {
"sms": "Your order #456 has been shipped."
}
}
]
}' \
https://app.duo.pt/transactional/{transactional_id}/transaction
Response: