POST /api/autoresponder.php
Endpoint can be used to opt-in subscribers and target specific automation workflows with “form submitted” trigger.
Unlike subscriber create or update requests, this endpoint triggers “subscriber opted-in” workflow when a subscriber is created or opted-in.
Note! This endpoint does not suit well for use cases where individuality of a message is a requirement (use Send Message API instead), because triggering an automation workflow is a reactive operation, meaning subscriber data is updated before the message is sent and updated subscriber data is used for templating. For example when automation workflow is triggered to the same recipient at the same time, the subscriber data of last update will be used to template each message queued for the recipient.
Request parameters
Parameter | Value |
autoresponder | Automation workflow ID. Note! When provided, automation has to be built using the “form submitted” trigger. |
addresses | List of email address objects. See “Addresses parameter structure” for more information. Required. |
from | Deprecated. Override autoresponder's default From address. |
from_name | Deprecated. Override autoresponder's default From name. |
Addresses parameter structure
Parameter value is a JSON list of JSON objects.
Parameter | Value |
Subscriber’s email address. Required. |
|
is_unsubscribed | Subscriber’s subscription status. 0 - not unsubscribed, emails will be delivered; 1 - unsubscribed. |
is_deleted | Delete subscriber. 0 - subscriber is not deleted; 1 - subscriber is deleted from database. Note! Does not affect unsubscribed status, custom data is purged. |
... | Custom field. New fields will be automatically created and attached with subscriber data. |
Response parameters
All possible response codes and their descriptions can be found in the “Response codes” page.
Parameter | Value |
code | Response code. |
message | Human-readable response message. |
addresses | List of accepted email addresses. |
Example
Trigger automation
$ curl -X POST -u "${USERNAME}:${PASSWORD}" \ -H "Content-Type: application/json" \ -d '{"addresses": [{"email": "subscriber+1@domain.tld"}], "autoresponder": 1}' \ "https://${SUBDOMAIN}.sendsmaily.net/api/autoresponder.php"
(JavaScript/JSON)
{ "code": 101, "message": "OK", "addresses": ["subscriber+1@domain.tld"] }
Trigger automation – with extra parameters
$ curl -X POST -u "${USERNAME}:${PASSWORD}" \ -H "Content-Type: application/json" \ -d '{"addresses": [{"email": "subscriber+1@domain.tld", "location": "Tallinn"}], "autoresponder": 1}' \ "https://${SUBDOMAIN}.sendsmaily.net/api/autoresponder.php"
(JavaScript/JSON)
{ "code": 101, "message": "OK", "addresses": ["subscriber+1@domain.tld"] }
Trigger automation – multiple contacts with extra parameters
$ curl -X POST -u "${USERNAME}:${PASSWORD}" \ -H "Content-Type: application/json" \ -d '{"addresses": [{"email": "subscriber+1@domain.tld", "location": "Tallinn"}, {"email": "subscriber+2@domain.tld", "location": "Tartu"}], "autoresponder": 1}' \ "https://${SUBDOMAIN}.sendsmaily.net/api/autoresponder.php"
(JavaScript/JSON)
{ "code": 101, "message": "OK", "addresses": ["subscriber+1@domain.tld", "subscriber+2@domain.tld"] }