unsubscribe

Synopsis:

This API will unsubscribe users to a particular campaign. Once a user is subscribed to a campaign they will receive all auto responders and scheduled messages for that campaign until they are unsubscribed through the API or through normal STOP or STOP ALL SMS request. You may not import someone who has unsubscribed themselves from a campaign however may re-subscribe someone who has unsubscribed through the Subscribe API.

Request: XML

<REQUEST>
    <ACTION>unsubscribe</ACTION>
    <API_KEY>apiKey</API_KEY>
    <CAMPAIGNREF>Campaign Reference ID</CAMPAIGNREF>
    <MOBILE>Number to unsubscribe</MOBILE>
    <NOTIFY>'yes/no' on whether to notify user on opt-out</NOTIFY>
</REQUEST>

Request: GET

API_URL?action=unsubscribe
&api_key=API key
&campaignref=campaign reference ID
&mobile=number to unsubscribe
&notify='yes/no' on whether to notify user on opt-out

Request Parameters:

Mandatory: action, api_key, campaignRef, mobile
Optional: notify

Response Parameters:

status, campaignRef, mobile, errorCode, errorInfo

Request Example: XML

<REQUEST>
    <ACTION>unsubscribe</ACTION>
    <API_KEY>qTFkykO9JTfahCOqJ0V2Wf5Cg1t8iWlZ</API_KEY>
    <CAMPAIGNREF>1116</CAMPAIGNREF>
    <MOBILE>16502426055</MOBILE>
    <NOTIFY>no</NOTIFY>
</REQUEST>

Request Example: GET

https://secure.skycore.com/API/wxml/1.3/index.php?action=unsubscribe
&api_key=qTFkykO9JTfahCOqJ0V2Wf5Cg1t8iWlZ
&campaignref=1116
&mobile=16502426055
&notify=no

Response Example: Success

<RESPONSE>
    <STATUS>Success</STATUS>
    <CAMPAIGNREF>1116</CAMPAIGNREF>
    <MOBILE>16502426055</MOBILE>
</RESPONSE>

Response Example: Failure

<RESPONSE>
    <STATUS>Failure</STATUS>
    <ERRORCODE>E721</ERRORCODE>
    <ERRORINFO>Invalid campaignref</ERRORINFO>
</RESPONSE>

Postback Notification:

Upon unsubscribing a number the system will generate a notification. For more details please visit the Mobile Unsubscribe section of the Opt-in Status Postback documentation.


General Error Codes:

Code Description
E100 Invalid request. Make a valid request via GET/POST/XML with all the required variables.
E104 User Authentication Failed.
E105 This account has no API rights.
E106 You can call API every X seconds.
E107 This account has no rights to use this action.
E108 XML Parse error: $error.
E109 API not activated.
E112 IP was not whitelisted. API call rejected.
E113 Set throughput exceeded for this API action. API call rejected.
E114 Phone number is blacklisted. API call rejected.
E120 Account has reached the API request limit.
E503 Internal error.


Code Description
E718 The ‘campaignref’ is required
E721 Invalid campaignref
E901 The ‘mobile’ is required.
E902 The ‘campaignid’ is required.
E903 Invalid ‘campaignid’.
E905 Could not unsubscribe this number.


Key Term Definitions:

Term Description
ACTION This is the name of the function you want to execute with the API.
API_KEY Random key that is assigned to an account that can be used for authorization instead of USER/PASS. You can find and regenerate this key on the ‘API Settings’ page.
CAMPAIGNID The ID(integer) of the campaign to which the user will be subscribed.
CAMPAIGNREF Depending on your API settings, you may be required to subscribe users into a campaign first before sending them messages. If you are required to subscribe a user first, then a valid Campaign Reference is required. This would be the campaign reference ID (string) to which the user is subscribed.
MOBILE A Phone Number used inside the ‘subscribe’/’unsubscribe’ function.
NOTIFY A mobile owner will be notified about being subscribed/unsubscribed via a confirmation SMS (yes/no).