API Senders provide an alternative to SMTP delivery, enabling integration 3. party integration
with almost any API. You can even use OAuth providers
and communicate with APIs requiring access tokens.
Lure delivery options are anything
you can think of.
To use API delivery, select API Sender during template creation.
| Setting | Description |
|---|---|
| Sender Name | Identifier for managing multiple API sender configurations |
| API Endpoint URL | URL for the email service API endpoint where delivery requests will be sent |
| HTTP Method | HTTP request method (POST, PUT, etc.) required by the email service API specification |
| API Key | Service API key or token, accessible as {{.APIKey}} variable in headers
and request body for secure authentication |
| OAuth Provider | Attach a OAuth provider for the API Sender, this enables the use of
{{.OAuthAccessToken}} variable in the request headers and body. |
| Request Headers | HTTP headers required by the API, including authentication, content-type, and custom service headers |
| Request Payload | JSON or form-encoded request body containing email content, recipient information, and service-specific parameters |
| Expected Status Code | HTTP response code indicating email submission (typically 200, 201, or 202) |
| Response Header Validation | Header content validation for confirmation of API interaction |
| Response Body Validation | Expected text or pattern in response body for comprehensive delivery confirmation |
| Custom Field 1-4 | User-defined variables accessible as {{.CustomField1}} through
{{.CustomField4}} for template personalization and API parameter customization |
API senders support template variables that can be used in the API Endpoint URL, Request Headers, and Request Body. These variables are dynamically replaced with actual values during campaign execution.
| Variable | Description | Available In |
|---|---|---|
{{.rID}} | Unique recipient identifier for tracking | URL, Headers, Body |
{{.FirstName}} | Recipient's first name | URL, Headers, Body |
{{.LastName}} | Recipient's last name | URL, Headers, Body |
{{.Email}} | Recipient's email address | URL, Headers, Body |
{{.To}} | Alias for recipient's email address (same as {{.Email}}) | URL, Headers, Body |
{{.Phone}} | Recipient's phone number | URL, Headers, Body |
{{.ExtraIdentifier}} | Additional custom identifier for recipient | URL, Headers, Body |
{{.Position}} | Recipient's job position | URL, Headers, Body |
{{.Department}} | Recipient's department | URL, Headers, Body |
{{.City}} | Recipient's city | URL, Headers, Body |
{{.Country}} | Recipient's country | URL, Headers, Body |
{{.Misc}} | Miscellaneous recipient information | URL, Headers, Body |
{{.From}} | Sender's full address (name and email) | URL, Headers, Body |
{{.FromName}} | Sender's display name | URL, Headers, Body |
{{.FromEmail}} | Sender's email address | URL, Headers, Body |
{{.Subject}} | Email subject line | URL, Headers, Body |
{{.BaseURL}} | Base URL of the campaign domain (e.g., https://example.com) | URL, Headers, Body |
{{.URL}} | Full campaign tracking URL with recipient identifier | URL, Headers, Body |
{{.Tracker}} | HTML tracking pixel markup for open tracking | Body |
{{.TrackingURL}} | Tracking pixel URL path | URL, Headers, Body |
{{.Content}} | Processed email content with all templates applied and JSON-escaped | Body |
{{.APIKey}} | API authentication key from sender configuration | URL, Headers, Body |
{{.OAuthAccessToken}} | OAuth access token when OAuth provider is configured | URL, Headers, Body |
{{.CustomField1}} | User-defined custom field 1 | URL, Headers, Body |
{{.CustomField2}} | User-defined custom field 2 | URL, Headers, Body |
{{.CustomField3}} | User-defined custom field 3 | URL, Headers, Body |
{{.CustomField4}} | User-defined custom field 4 | URL, Headers, Body |
{{.RandomRecipient.*}} | Access to a random recipient's data from the same company (excludes current recipient).
Available fields: FirstName, LastName,
Email, Phone, ExtraIdentifier,
Position, Department, City,
Country, Misc | URL, Headers, Body |
Request Header with OAuth:
Authorization: Bearer {{.OAuthAccessToken}} Request Body with recipient data:
{
"to": "{{.Email}}",
"from": "{{.FromEmail}}",
"subject": "{{.Subject}}",
"html": "{{.Content}}",
"personalizations": {
"name": "{{.FirstName}} {{.LastName}}"
}
} API Endpoint URL with parameters:
https://api.example.com/v1/send?recipient_id={{.rID}}&api_key={{.APIKey}} API senders support powerful template functions for dynamic content generation and data manipulation in the API Endpoint URL, Request Headers, and Request Body:
| Function | Description | Example |
|---|---|---|
urlEscape | URL-encodes a string for safe use in URLs | {{urlEscape .Email}} |
htmlEscape | HTML-escapes a string to prevent markup interpretation | {{htmlEscape .FirstName}} |
randInt | Generates a random integer between two numbers (inclusive) | {{randInt 1 100}} (returns number between 1-100) |
randAlpha | Generates a random alphabetic string of specified length | {{randAlpha 8}} (returns 8 random letters) |
qr | Generates an HTML QR code from a string | {{qr .URL}} |
date | Formats current date/time with optional offset in seconds. Format uses standard date tokens (YYYY, MM, DD, HH, mm, ss) | {{date "YYYY-MM-DD"}}{{date "DD/MM/YYYY HH:mm" 3600}} (1 hour ahead) |
base64 | Base64-encodes a string | {{base64 .Email}} |
URL with escaped parameters:
https://api.example.com/send?email={{urlEscape .Email}}&name={{urlEscape .FirstName}} Request body with random verification code:
{
"to": "{{.Email}}",
"subject": "Verification Code: {{randInt 100000 999999}}",
"html": "{{.Content}}",
"metadata": {
"session_id": "{{randAlpha 16}}",
"timestamp": "{{date "YYYY-MM-DD HH:mm:ss"}}"
}
} Header with base64-encoded authentication:
X-Custom-Auth: {{base64 .APIKey}}