Guides & Tutorials

Opt-in subscriber(s)

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.

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
email 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.

Examples

Opt-in subscriber

$ curl -X POST -u "${USERNAME}:${PASSWORD}" \
  -H "Content-Type: application/json" \
  -d '{"addresses": [{"email": "subscriber+1@domain.tld"}, {"email": "subscriber+2@domain.tld", "foo": "bar"}, {"email": "subscriber+invalid"}]}' \
  "https://${SUBDOMAIN}.sendsmaily.net/api/autoresponder.php"

(JavaScript/JSON)

{
  "code": 101,
  "message": "OK",
  "addresses": ["subscriber+1@domain.tld", "subscriber+2@domain.tld"]
}

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"]
}