Track clicks & opens
Learn how to track links click and emails opening using Unipile API.
Unipile allow you to be notified when an email is open or a link is clicked by the recipient using webhooks.
Setup
1. Configure a webhook
Configure a webhook to receive the wanted events:
tracking.opento be notified when an email is opentracking.clickto be notified when a link is clicked
2. Send your email from Unipile
To make this works, send your Emails with Send an Email method and provide:
- An
htmlcontent (onlyplain_textwon't work) - Tracking options with
links: trueto track clicked links andopens: trueto track opened emails. - An optional
labelto be sent in the webhook payload. This can be used to identify the sent mail. - An optional
custom_domainpointing to https://tracking.unipile.com/ to keep a white label on links tracking.
You can also specify those options on Create a Draft method then send it with Send a Draft.
await emailsApi.sendEmail({
path: {
account_id: "acc_123456789",
},
body: {
to: [
{
display_name: 'John Doe',
email: '[email protected]',
},
],
subject: 'Hello',
html: '<a href="https://unipile.com">This link will be tracked</a>',
tracking_options: {
opens: true,
links: true,
label: 'marketing'
},
},
});emails_api.send_email(
"acc_123456789",
{
"to": [
{
"display_name": "John Doe",
"email": "[email protected]",
}
],
"subject": "Hello",
"html": '<a href="https://unipile.com">This link will be tracked</a>',
"tracking_options": {
"opens": True,
"links": True,
"label": "marketing",
},
},
)curl --request POST \
--url https://api.unipile.com/v2/account_id/emails/send \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"to": [
{
"display_name": "John Doe",
"email": "[email protected]"
}
],
"subject": "Hello",
"html": "<a href=\"https://unipile.com\">This link will be tracked</a>",
"tracking_options": {
"opens": true,
"links": true,
"label": "marketing"
}
}
'3. Handle events
In your webhook handler, you should now receive events with the following payload if the recipient opens or click a link in the email.
{
"ip": "127.1.1.1",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36",
"date": "2025-08-14T14:30:00Z",
"label": "marketing"
}{
"url": "https://mylink.com",
"ip": "127.1.1.1",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36",
"date": "2025-08-14T14:30:00Z",
"label": "marketing"
}Updated about 1 month ago
What’s Next