Get Subscribers Status

Get the status of a subscriber based on an Orgcode. If you provide parent level OrgCode, then it will display all the groups under the parent and status of the subscribers.

Overview

Get the status of a subscriber based on an Orgcode. If you provide parent level Org Code, then it will display all the groups under the parent and status of the subscribers.

Note: Phone list allows a maximum of 100 mobile numbers per request.

Syntax

C#

[OperationContractAttribute()]
SBT.API.DataContracts.Admin.WSSubscribersStatusResponse GetSubscribersStatus(
  string securityToken,
  string  orgCode,
  List  phone
)

 

WSDL

Production: https://ui.solutionsbytext.com/Sbt.App.SetUp/WSServices/subscriberWSService.svc?singleWsdl

Staging: https://test.solutionsbytext.com/Sbt.App.SetUp/WSServices/subscriberWSService.svc?singleWsdl

 

 

Parameters

securityToken

– String[1000] (Required) – SecurityToken to authenticate the user

orgCode

– String[20] (Required) – Default Organization Code for Group, Division, Organization and Tenant.

phone

List<string> (Required) – List of phone numbers to be checked for status (maximum of 100 mobile numbers).

 

Return Value

WSSubscribersStatusResponse
NameTypeDescription
ResultboolTrue/False whether the call was successful or not.
ErrorCodeintFor Success/Failure it returns an error number
MessagestringMessage related to error code.
ResponseList<SubscriberStatus>

SubscriberStatus object 
*Group – Subscriber subscription group. 

*Phone – Subscriber mobile number.

*CarrierID – Carrier Code of a subscriber mobile number.

*Carrier – Carrier Name of a subscriber mobile number.

*StatusID – StatusID of a subscriber mobile number

(0=Not a subscriber, 1=Active, 2=Inactive, 16=Underverification, 26=Block).

*Status – Status type of a subscriber mobile number.

*OptInMethodID – Opt in ID of a subscriber mobile number

(1=UI, 2=VBT / Widget, 3=Keyword, 4=FileUpload, 5=API).

*OptInMethod – Opt In Type of a subscriber mobile number. 

*OptInDate – First opt in of a subscriber mobile number. 

*LatestOptInOutDate – Last opt in or opt out date of a subscriber mobile number.

*UniqueID – UniqueID of the Subscriber

 

Remarks

WSSubscribersStatusResponse

 

Developer Tips

The GetSubscribersStatus method reveals the current opt-in / opt-out status of a subscriber in the Solutions by Text platform. 

Best practice recommendations are:

  1. Check the opt-in status of a subscriber or subscribers prior to delivering text campaigns so as to ensure the highest rate of successful message delivery for the campaign
  2. Only subscribers with StatusID = 1 should be included in the message delivery campaign
  3. Record the opt-in / opt-out status in order to fine-tune subsequent campaign delivery attempts
  4. Subscribers with StatusID <> 1 should be marked as opted-out

 

Example

C#

 SubscriberClient subscriberService = new SubscriberClient("SubscriberWSServiceHttpEndpoint");
    string securityToken = txtToken.Text;
    string orgCode = txtOrgCode.Text;
    List<string> phone = new List<string>();
    string mobileNumber = txtMobileNo.Text;
    phone.Add(mobileNumber);
    
	WSSubscribersStatusResponse wSSubscribersStatusResponse = subscriberService.GetSubscribersStatus(securityToken, orgCode, phone.ToArray());
        if (!wSSubscribersStatusResponse.Result)
            {
                //handle error
                lblError.Text = wSSubscribersStatusResponse.Message;
            }
        else
            {
                //handle success
                lblError.Text = wSSubscribersStatusResponse.Message;
            }

SOAP

Soap Request
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://SBTService/ServiceContracts/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:GetSubscribersStatus>
         <!--Required:-->
         <ser:securityToken>Security Token</ser:securityToken>
         <!--Required:-->
         <ser:orgCode>Org code of Group, Division, Organization or Tenent</ser:orgCode>
         <!--Required:-->
         <ser:phone>
            <!--Zero or more repetitions:-->
            <arr:string>Mobile Number</arr:string>
         </ser:phone>
      </ser:GetSubscribersStatus>
   </soapenv:Body>
</soapenv:Envelope>
    
  Soap Response
  
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <GetSubscribersStatusResponse xmlns="http://SBTService/ServiceContracts/">
         <GetSubscribersStatusResult z:Id="i1" xmlns:a="http://SBTAPIService/DataContract/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
            <a:Result>true</a:Result>
            <a:ErrorCode>1457</a:ErrorCode>
            <a:Message>Successfully retrieved subscriber status</a:Message>
            <a:Response>
               <a:SubscriberStatus z:Id="i2">
                  <a:Group>Group Name</a:Group>
                  <a:Phone>Phone Number</a:Phone>
                  <a:CarrierID>79</a:CarrierID>
                  <a:Carrier>T-Mobile</a:Carrier>
                  <a:StatusID>1</a:StatusID>
                  <a:Status>Active</a:Status>
                  <a:OptInMethodID>1</a:OptInMethodID>
                  <a:OptInMethod>UI</a:OptInMethod>
                  <a:OptInDate>6/26/2014 6:10:24 AM</a:OptInDate>
                  <a:LatestOptInOutDate>5/18/2016 6:30:52 AM</a:LatestOptInOutDate>
                  <a:UniqueID>TestUID</a:UniqueID>
               </a:SubscriberStatus>
            </a:Response>
         </GetSubscribersStatusResult>
      </GetSubscribersStatusResponse>
   </s:Body>
</s:Envelope>

PHP

<?php
    $client = new SoapClient("https://ui.solutionsbytext.com/Sbt.App.SetUp/wsservices/subscriberWSService.svc?wsdl");
    $param = array(
	'securityToken' => 'securityToken',
	'phone' => array('12345678901'),
	'orgCode' => 'orgCode'
);
$response = $client->__soapCall('GetSubscribersStatus', array($param));
echo '<pre/>';
print_r($response);
if($response->GetSubscribersStatusResult->Result){
	echo 'Message: '.$response->GetSubscribersStatusResult->Message;
}
else {
	echo 'Message: '.$response->GetSubscribersStatusResult->Message;
}
?>

REST

Method: GET

URL: https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/SubscriberRSService.svc/GetSubscribersStatus?securityToken=safdsfs&orgCode=dfsf&phone=[“test”,”test123″,”test456″]

 

Sample C# Code:

var listOfPhones = new string[] { "test", "test123", "test456" };
                var ArrlistOfPhones = JsonConvert.SerializeObject(listOfPhones).ToString();                
                System.Net.WebClient webClientGet = new System.Net.WebClient();
                Uri getURi = new Uri("https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/SubscriberRSService.svc/GetSubscribersStatus?securityToken=" + "safdsfs" + "&orgCode=" + "dfsf" + "&phone=" + ArrlistOfPhones + "");
                txtRequestFormat.Text = getURi.ToString();
var GetSubscriberStatusResponse = webClientGet.DownloadString(getURi);
Note: “GetSubscriberStatusResponse” will be in JSON format.

 

Response:

The response will be in JSON format like below:
{" GetSubscribersStatusResult": {
   "Result": true,
   "ErrorCode": 1457,
   "Message": " Successfully retrieved subscriber status",
   “
}}

 

Send Feedback

Back to all documentation