API Reference - Email Automation Settings
Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108095
← Back to API Reference | Getting Started
Email Automation Settings
Email Automation Settings define the rules that govern automated email sending. Each rule specifies what action triggers an email, who receives it, and how many days after the trigger it is sent.
Model name in URL:
email_automation_settings — DB table: email_automation_settingsThe Email Automation Settings Object
| Field | Type | Description |
|---|---|---|
rule_id | integer | Unique rule ID (primary key, read-only) |
rule_name | string | Internal name/slug identifying the automation trigger (EG new_payment_received) required on create |
rule_email_days | integer | Number of days after the trigger event to send the email; 0 means send immediately |
rule_email_member | string | Email template name to send to the member; empty string disables member email |
rule_billing_cycles | string | Comma-separated billing cycle values this rule applies to; empty string applies to all |
rule_email_admin | integer | Whether to notify the site admin: 1 yes, 0 no |
rule_copy_admin | integer | Whether to send a copy of the member email to the admin: 1 yes, 0 no |
rule_email_attachment | integer | Whether to include a PDF attachment with the email: 1 yes, 0 no |
rule_updated_by | string | Email address of the admin who last updated this rule |
revision_timestamp | timestamp | Timestamp of the last modification (auto-managed) |
List Email Automation Settings
GET /api/v2/email_automation_settings/get
Example Request
Copy
curl -X GET "https://www.yourdomain.com/api/v2/email_automation_settings/get?limit=25" \ -H "X-Api-Key: your-api-key-here"
Example Response
Copy
{
"status": "success",
"message": [
{
"rule_id": "1",
"rule_name": "new_payment_received",
"rule_email_days": "0",
"rule_email_member": "0",
"rule_billing_cycles": "",
"rule_email_admin": "0",
"rule_copy_admin": "0",
"rule_email_attachment": "0",
"rule_updated_by": "admin@example.com",
"revision_timestamp": "2024-03-20 13:05:49"
},
{
"rule_id": "2",
"rule_name": "upcoming_reminder",
"rule_email_days": "7",
"rule_email_member": "0",
"rule_billing_cycles": "",
"rule_email_admin": "0",
"rule_copy_admin": "0",
"rule_email_attachment": "0",
"rule_updated_by": "admin@example.com",
"revision_timestamp": "2024-03-20 13:05:49"
}
],
"total": "5",
"current_page": 1,
"total_pages": 1,
"next_page": ""
}Retrieve an Email Automation Rule
GET /api/v2/email_automation_settings/get/{rule_id}
Example Request
Copy
curl -X GET "https://www.yourdomain.com/api/v2/email_automation_settings/get/1" \ -H "X-Api-Key: your-api-key-here"
Example Response
Copy
{
"status": "success",
"message": [
{
"rule_id": "1",
"rule_name": "new_payment_received",
"rule_email_days": "0",
"rule_email_member": "0",
"rule_billing_cycles": "",
"rule_email_admin": "0",
"rule_copy_admin": "0",
"rule_email_attachment": "0",
"rule_updated_by": "admin@example.com",
"revision_timestamp": "2024-03-20 13:05:49"
}
],
"total": "5",
"current_page": 1,
"total_pages": 1
}Create an Email Automation Rule
POST /api/v2/email_automation_settings/create
Example Request
Copy
curl -X POST "https://www.yourdomain.com/api/v2/email_automation_settings/create" \ -H "X-Api-Key: your-api-key-here" \ -d "rule_name=account_expired" \ -d "rule_email_days=0" \ -d "rule_email_member=account-expired-notice" \ -d "rule_email_admin=1" \ -d "rule_copy_admin=0" \ -d "rule_email_attachment=0" \ -d "rule_updated_by=admin%40example.com"
Example Response
Copy
{
"status": "success",
"message": {
"rule_id": "6",
"rule_name": "account_expired",
"rule_email_days": "0",
"rule_email_member": "account-expired-notice",
"rule_billing_cycles": null,
"rule_email_admin": "1",
"rule_copy_admin": "0",
"rule_email_attachment": "0",
"rule_updated_by": "admin@example.com",
"revision_timestamp": null
}
}Update an Email Automation Rule
PUT /api/v2/email_automation_settings/update
Example Request
Copy
curl -X PUT "https://www.yourdomain.com/api/v2/email_automation_settings/update" \ -H "X-Api-Key: your-api-key-here" \ -d "rule_id=6" \ -d "rule_email_days=1" \ -d "rule_email_attachment=1"
Example Response
Copy
{
"status": "success",
"message": {
"rule_id": "6",
"rule_name": "account_expired",
"rule_email_days": "1",
"rule_email_attachment": "1",
"revision_timestamp": "2024-04-01 11:00:00"
}
}Delete an Email Automation Rule
DELETE /api/v2/email_automation_settings/delete
Example Request
Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/email_automation_settings/delete" \ -H "X-Api-Key: your-api-key-here" \ -d "rule_id=6"
Example Response
Copy
{
"status": "success",
"message": "email_automation_settings record was deleted"
}