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/Update Receiver: You add the receiver to your CleverReach list, but they are initially set to an inactive state (e.g.,
active: false). - Trigger DOI Email: You trigger a 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: CleverReach automatically confirms the subscription and sets the receiver to
active = true.
Before using the API to trigger DOI emails, you must create a Form within your CleverReach account 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 Receiver (Inactive)
First, add the receiver 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 receiver exists (in an inactive state), you instruct CleverReach to send the DOI email. This requires a specific Flow ID.
POST /v3/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.