Business at the Speed of Text

Take a few minutes to watch how Solutions by Text can provide you with a compliant solution to enhance the customer experience and increase your bottom line through the power of texting.

Watch Videos

Two-Way Texting Changes the Game

Put real-time text responses in your customers’ pockets and real-time access at your staff’s fingertips.

Find Out More

Two-Way Texting Changes the Game

Put real-time text responses in your customers’ pockets and real-time access at your staff’s fingertips.

Find Out More

Business at the Speed of Text

Take a few minutes to watch how Solutions by Text can provide you with a compliant solution to enhance the customer experience and increase your bottom line through the power of texting.

Watch Videos

We're here for you.

Solutions by Text offers 24 hour support - both online and offline.

Give us a Call

Two-Way Texting Changes the Game

Put real-time text responses in your customers’ pockets and real-time access at your staff’s fingertips.

Find Out More

See What's New

Solutions by Text continues to evolve and develop its suite of products and features. Take a look at what's new in our world.

Read more

We Work With the Best

From retail to financial solutions, we’re constantly working with our clients to push the boundaries and find new ways to leverage SMS for business.

See Our Success Stories

Overview

This method removes subscribers from a specified group by making them inactive. Group, Division or Organization code can be designated to remove the subscription(s).

 

Syntax

C#

[OperationContractAttribute()]
SBT.API.DataContracts.Admin.WSUnsubscriberResponse UnSubscribe(
   string securityToken,
   SBT.API.DataContracts.Admin.SubscriberDetails unsubscribe
)

 

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

subscriber

* MobilePhone - String[20] (Required) - MobilePhone number with country code.
* OrgCode - String[20] (Required) - Default Organization Code for Group, Division, Organization and company to which the subscription is to be removed. If Org code of Division is used, then subscriber in all groups under the division will be unsubscribed. This process applies to Organization and Company also.

 

Return Value

WSUnsubscriberResponse
NameTypeDescription
Result bool True/False whether the call was successful or not.
ErrorCode int For Success/Failure it returns an error number.
Message string Message related to the error code.

 

Remarks

WSUnsubscriberResponse

 

Examples

C#

SubscriberClient subscriberResult = new SubscriberClient("SubscriberWSServiceHttpEndpoint");

    string securityToken = txtToken.Text; ;

    SubscriberDetails subscriber = new SubscriberDetails();
    subscriber.MobilePhone = txtMobileNo.Text;
    subscriber.OrgCode = txtOrgCode.Text;
    
	WSUnsubscriberResponse wsUnSubscribeResponse = subscriberResult.UnSubscribe(securityToken, subscriber);

        if (!wsUnSubscribeResponse.Result)
            {
                //handle error
                lblError.Text = wsUnSubscribeResponse.Message;
            }
        else
            {
                //handle success
                lblError.Text = wsUnSubscribeResponse.Message;
            }

SOAP

Soap Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://SBTService/ServiceContracts/" xmlns:ser1="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:dat="http://SBTAPIService/DataContract/">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:UnSubscribe>
         <!--Required:-->
         <ser:securityToken>Security Token</ser:securityToken>
            <ser:subscriber>
            <!--Required:-->
            <dat:MobilePhone>Mobile Number</dat:MobilePhone>
            <!--Required:-->
            <dat:OrgCode>Org Code of Group, Division or Organization</dat:OrgCode>
         </ser:subscriber>
      </ser:UnSubscribe>
   </soapenv:Body>
</soapenv:Envelope>
    
  Soap Response
  
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <UnSubscribeResponse xmlns="http://SBTService/ServiceContracts/">
         <UnSubscribeResult 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:ErrorCode>1016</a:ErrorCode>
            <a:Message>Subscriber unsubscribed successfully</a:Message>
            <a:Result>true</a:Result>
         </UnSubscribeResult>
      </UnSubscribeResponse>
   </s:Body>
</s:Envelope>

JAVA

  SubscriberWSService srv = new SubscriberWSService();
  ISubscriber iSubscriber = srv.getSubscriberWSServiceHttpEndpoint1();
  WSUnsubscriberResponse res = null;
		
  String  securityToken = "securityToken";
  SubscriberDetails subscriber = new SubscriberDetails();		
		
  subscriber.setEmail(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "Email"),
				new String("").getClass(),"Email"));
  subscriber.setId("123");
  subscriber.setSubscribedType(2);
  //subscriber.setRef();
  subscriber.setMobilePhone(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "MobilePhone"),
				new String("").getClass(),"12345678977"));
  subscriber.setOrgCode(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "OrgCode"),
				new String("").getClass(),"5hi60s8"));
  try {
		res = iSubscriber.unSubscribe(securityToken, subscriber);

  } catch (Throwable e) {
		e.printStackTrace();
  }

  if(res == null ){
	  System.out.println("::Erron::");
	  return;

  }
  if (res.isResult() == null || !res.isResult())
  {
	//handle error
	System.out.println("ErrorCode::"+res.getErrorCode());
	System.out.println("ErrorMessage::"+res.getMessage().getValue());
  }
  else
  {
	 //handle success
	System.out.println("ID::"+res.getId());
	System.out.println("Message::"+res.getMessage().getValue());
  }

PHP

<?php 
    $client = new SoapClient("https://ui.solutionsbytext.com/Sbt.App.SetUp/wsservices/subscriberWSService.svc?wsdl");
    $param = array(
	'securityToken' =--> 'securityToken',
	'subscriber' => array(
		'MobilePhone' => '123456789082',
		'OrgCode' => 'OrgCode'
	)
);

$response = $client->__soapCall('UnSubscribe', array($param));
echo '<pre?>';
print_r($response);
if($response->UnSubscribeResult->Result){
	echo 'Message: '.$response->UnSubscribeResult->Message;
}
else {
	echo 'Message: '.$response->UnSubscribeResult->Message;
}

?>

 

REST

Method: POST

URL: https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/SubscriberRSService.svc/UnSubscribe

Sample C# Code:

SubscriberDetails subDetails = new SubscriberDetails
                {
                    OrgCode = "h213d45",                    
                    MobilePhone = "1234567891"                   
                };

                DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(SubscriberDetails));
                MemoryStream mem = new MemoryStream();
                ser.WriteObject(mem, subDetails);
                string data = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);

                var requestdata = new
                {
                    securityToken = "validsecurityToken",
                    subscriber = subDetails
                };

                string data2 = JsonConvert.SerializeObject(requestdata).ToString();
                txtRequestFormat.Text = data2;

                System.Net.WebClient webClient = new System.Net.WebClient();
                webClient.Headers["Content-type"] = "application/json";
                webClient.Encoding = Encoding.UTF8;
var strResult = webClient.UploadString("http://54.183.213.68/SBT.App.SetUp/RSServices/SubscriberRSService.svc/UnSubscribe", "POST", data2);

Note: Above “strResult” reponse contains the output response in JSON format.

 

Response:

The response will be in JSON format like below:

{" UnSubscribeResult": {
   "Result": true,
   "ErrorCode": 1013,
   "Message": " Subscriber information saved successfully"
}}

 

 

Send Feedback