Double Opt-In
The Double Opt-In (DOI) process is crucial for ensuring that a subscriber actually owns the email address they provided and actively consents to receiving your emails. In many jurisdictions (such as under the GDPR), a strict Double Opt-In process is legally required.
With CleverReach, sending DOI emails and confirming signups via the API is fully supported and highly recommended.
Overview of the Flow
Implementing Double Opt-In via the API involves the following steps:
- Create the recipient as inactive: Add the recipient to your CleverReach list with
registeredset to the current Unix timestamp andactivated = 0, pending DOI confirmation. - Trigger DOI Email: You trigger an automation flow (which contains a DOI mailing template) to send the activation email.
- User Action: The user clicks the activation link in the email.
- Confirmation: After successful DOI confirmation, CleverReach updates the recipient’s activation status. The computed
activefield reflects activation status only. blacklist status and other email-eligibility checks are evaluated separately.
Before using the API to trigger DOI emails, you must create a Form within your CleverReach accountorn and configure the Double Opt-In Email template. You will need the Flow ID to trigger the process via the API.
Step-by-Step Implementation
1. Add Recipient (Inactive)
First, add the recipient to a specific group (list). Ensure they are added as inactive.
POST /v3/groups.json/{group_id}/receivers
Authorization: Bearer <your_access_token>
Content-Type: application/json
{
"email": "john.doe@example.com",
"registered": 1690000000,
"activated": 0,
"source": "My Custom Form",
"global_attributes": {
"firstname": "John",
"lastname": "Doe"
}
}
2. Trigger the Activation Email
Once the recipient exists (in an inactive state), you instruct CleverReach to send the DOI email. This requires a specific Flow ID.
POST /flow/flow/{flow_id}/send
Authorization: Bearer <your_access_token>
Content-Type: application/json
{
"receiver_id": "john.doe@example.com",
"doidata": {
"user_ip": "192.168.0.1",
"referer": "https://www.myshop.com/newsletter-signup",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)..."
}
}
The doidata object allows you to attach legal proof to the subscriber. Capturing the user's IP, browser agent, and exact sign-up URL provides an excellent audit trail should you ever need to prove consent.
Summary
- Always prefer letting CleverReach handle the Double Opt-In mailing via
POST /flow/flow/{flow_id}/send. - Provide
doidatato maintain a robust legal audit trail. - Ensure you have configured a Flow and its associated DOI email template in the CleverReach Dashboard prior to making API calls.