Possible responses from Sendy’s subscribe API call

Sendy is a self-hosted email marketing tool; while hooking up a subscription form, I needed to work out what all the possible responses are to a user subscribing, depending on their current status in the Sendy database.

Version

The version documented here is 2.0.7. The previous version had a bug in it which prevented the 'Already subscribed.' status from being returned as plain text and it would always return a full HTML page. If you are using an older version, you should upgrade.

Example API call using PHP

The following example calls the subscribe API function. Replace /path/to/sendy with the full domain and path to your Sendy install, and obviously the other fields too. The 'boolean' value in the data array is set to a text value of 'true' to return the response as plain text.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '/path/to/sendy/subscribe');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
	'name' => '<name here>',
	'email' => '<email address here>',
	'list' => '<list id here>,
	'boolean' => 'true'
));
$response = curl_exec($ch);
curl_close($ch);

Possible responses, when double opt in is enabled

Note, you can also get other error messages such as 'Some fields are missing.' but these reponses assume all fields are completed and the email address is valid.

  • User is already active in Sendy: API returns 'Already subscribed.'
  • User is not yet in Sendy: an opt in email is sent and the API returns '1'
  • User has not yet confirmed the double opt in: another opt in email is sent, and the API returns '1'
  • User has previously unsubscribed from Sendy: the opt in email is NOT sent, the user is set back to subscribed, and the API returns '1'
  • User has been marked as soft bounced: the opt in email is NOT sent, there is no status change, and the API returns 'Already subscribed.'
  • User has been marked as hard bounced: the opt in email is NOT sent, there is no status change, and the API returns 'Already subscribed.'
  • User has marked one of your email messages as spam: the opt in email is NOT sent, there is no status change, and the API returns 'Already subscribed.'