Developer Network

API Reference: Subscriber.Add

Subscribes an email address to an existing subscriber list. Addition to email address, any other custom field can be provided.

If the target subscriber list is set as double opt-in, Sendloop will send an opt-in confirmation request email to the subscriber email address and until subscription gets confirmed by the email address owner, account will not be available for campaign sending.

Input Parameters

Following parameters are required by this command:

  • APIKey
    Your user account API key. You can learn your API key in your Sendloop area > Manage Account section
  • Command
    For subscribing an email address, you should set this parameter to 'Subscriber.Add'
  • ListID ID number of the target subscriber list. List ID can be gathered from Lists > List Overview > List Settings section
  • Email Address
    The email address which should be subscribed to the target subscriber list
  • Custom Field (can be more than one)
    You can also add additional information about the email address owner (ex: name, age, country, etc.) to subscriber account. You can pass unlimited amount of custom field. Be sure that you have created custom fields in subscriber list section for the data that is going to be passed through.
  • Subscription IP Address
    IP address of the subscriber must be provided in order to track opt-in status

Output

Sendloop will return some information about the request status. Sendloop always return in XML-RPC format. Below, you can see the list of all available codes and messages which can be returned by this command:

Error Codes and Messages:

One of the following error messages will be returned if any error occurs:

  • #1
    Connection type is not compatible
  • #2
    Invalid API key or user account is not available
  • #3
    Subscriber list does not exist or not available
  • #4
    Email address is missing
  • #5
    Email address format is illegal
  • #6
    Email address already exists in the subscriber list
  • #7
    Email address is invalid

Success Message

Success message will include the following three parameters:

  • Status
    'Waiting For Opt-In Confirmation' or 'Subscribed' depending on opt-in setting of the subscriber list
  • SubscriberID
    The ID number of new subscriber
  • RedirectURL
    Redirection URL set in Subscriber List Integration Settings section

Examples

We provided examples in all three accepted messaging formats. Bold texts means data that needs to be replaced by you.

HTTP-POST Example

Input:

POST /api/index.php HTTP/1.1
Host: yoursubdomain.sendloop.com
Content-Type: application/x-www-form-urlencoded

FormValue_APIKey=YourAPIKeyHere&FormValue_Command=Subscriber.Add&
FormValue_ListID=10&FormValue_Fields[EmailAddress]=test@dummy.com&
FormValue_Fields[CustomField10]=Example%20Name&FormValue_SubscriptionIP=88.88.88.88

HTTP-GET Example

GET /api/index.php?APIKey=YourAPIKeyHere&Command=Subscriber.Add&ListID=10&
Fields[EmailAddress]=test@dummy.com&Fields[CustomField10]=Example%20Name&
SubscriptionIP=88.88.88.88 HTTP/1.1 Host: yoursubdomain.sendloop.com

XML-RPC Example

To connect Sendloop API through XML-RPC messaging format, you will need to pass XML-RPC code via HTTP-POST or HTTP-GET method:

XML-RPC connection via HTTP-POST:

POST /api/index.php HTTP/1.1
Host: yoursubdomain.sendloop.com
Content-Type: application/x-www-form-urlencoded

FormValue_Message=<<<The following XML structure must be inserted here with URL
encoded structure>>> <Entry>  <Message>   <APIKey>YourAPIKeyHere</APIKey>   <Command>Subscriber.Add</Command>   <ListID>10</ListID>   <SubscriptionIP>88.88.88.88</SubscriptionIP>   <Fields>    <EmailAddress>test@dummy.com</EmailAddress>   </Fields>  </Message> </Entry>

XML-RPC connection via HTTP-GET:

GET /api/index.php?FormValue_Message=<<<The following XML structure must be
inserted here with URL encoded structure>>> HTTP/1.1 Host: yoursubdomain.sendloop.com <Entry>  <Message>   <APIKey>YourAPIKeyHere</APIKey>   <Command>Subscriber.Add</Command>   <ListID>10</ListID>   <SubscriptionIP>88.88.88.88</SubscriptionIP>   <Fields>    <EmailAddress>test@dummy.com</EmailAddress>   </Fields>  </Message> </Entry>

Error Output Example

<value>
 <struct>
  <member>
   <name>APIError</name>
   <value><string>Subscriber list does not exist
     or not available</string></value>
  </member>
  <member>
   <name>APIErrorCode</name>
   <value><string>3</string></value>
  </member>
 </struct>
</value>

Success Output Example

<value>
 <struct>
  <member>
   <name>Status</name>
   <value><string>Waiting For Opt-In Confirmation</string></value>
  </member>
  <member>
   <name>SubscriberID</name>
   <value><string>349</string></value>
  </member>
  <member>
   <name>RedirectURL</name>
   <value><string>http://your.target.url/</string></value>
  </member>
 </struct>
</value>

API Reference

Campaign Functions

Subscriber List Functions

Subscriber Custom Field Functions

Subscriber List Segment Functions

Subscriber List Integration Functions

Subscriber Functions

Report Functions

Media Library Functions

Chart Functions