Overview
This method updates subscriber information like First Name, Last Name, Unique ID etc., based on the Organization. This method is useful in cases where the same subscriber can have different values (e.g. account number) in different Organizations of the same tenant.
Note: This method should be configured for use, hence before using this method please contact SBT team.
Syntax
C#
[OperationContractAttribute()] SBT.API.DataContracts.Admin.WSSubscriberResponse UpdateSubscriberByOrg( string securityToken, string OrgCode, SBT.API.DataContracts.Admin.SubscriberInfo subscriber )
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) – Subscriber’s org code. This only works with Organization (Brand) level Org code
SubscriberInfo
* MobilePhone - String[20] (Required) - MobilePhone number with country code.
* FName - String[100] (Optional) - First Name of a subscriber (private information).
* LName - String[100] (Optional) - Last Name of a subscriber (private information).
* Email - String[100] (Optional) – Email ID of a subscriber (private information).
* City - String[100] (Optional) - City address of a subscriber (private information).
* Street - String[100] (Optional) - Street address of a subscriber (private information).
* Street2 - String[100] (Optional) – Street address of a subscriber (private information).
* ZipCode - String[10] (Optional) – Zip Code of a subscriber (private information).
* CustomField1 - String[100] (Optional) - CustomField1 of a subscriber (private information).
* CustomField2 - String[100] (Optional) - CustomField2 of a subscriber (private information).
* CustomField3 - String[100] (Optional) - CustomField3 of a subscriber (private information).
* PrivateCode - String[100] (Optional) - PrivateCode of a subscriber (private information).
* UniqueID - String[100] (Optional) - UniqueID of a subscriber (private information).
Note: Please Use "UniqueID" field to update the subscriber unique id. "PrivateCode" is obsolete.
Return Value
WSSubscriberResponse
Name | Type | Description |
---|---|---|
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
WSSubscriberResponse
Developer Tips
The UpdateSubscriberByOrg method provides the ability to associate a unique identifier (e.g. account number, customer number, application number, etc.) with the mobile phone number subscription in the Solutions by Text platform at the individual Organization level. This unique ID is then returned in reports, posts to the Status URL(s) and posts to the Callback URL(s).
The UpdateSubscriberByOrg is primarily utilized by organizations managing multiple brands. That is, organizations have the ability to assign different account numbers to the same phone number across mutiple brands. With the association of unique ID data, clients are able to map outbound / inbound messages back to the customer record / history.
Examples
C#
SubscriberClient subscriberService = new SubscriberClient("SubscriberWSServiceHttpEndpoint"); SubscriberInfo subscriber = new SubscriberInfo(); string securityToken = txtToken.Text; string orgCode = txtOrgCode.Text; subscriber.MobilePhone = txtMobileNo.Text; subscriber.FName = txtFName.Text; subscriber.LName = txtLName.Text; subscriber.Email = txtEmail.Text; subscriber.City = txtCity.Text; subscriber.Street = txtStreet.Text; subscriber.Street2 = txtStreet2.Text; subscriber.ZipCode = txtZipcode.Text; subscriber.CustomField1 = txtCF1.Text; subscriber.CustomField2 = txtCF2.Text; subscriber.CustomField3 = txtCF3.Text; subscriber.PrivateCode = txtPrivateCode.Text; subscriber.UniqueID = txtPrivateCode.Text; WSSubscriberResponse wSSubscriberResponse = subscriberService.UpdateSubscriberByOrg(securityToken,orgCode, subscriber); if (!wSSubscriberResponse.Result) { //handle error lblError.Text = wSSubscriberResponse.Message; } else { //handle success lblError.Text = wSSubscriberResponse.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:UpdateSubscriberByOrg> <!--Required:--> <ser:securityToken>Security Token</ser:securityToken> <!--Required:--> <ser:orgCode>Organization Code only allowed</ser:orgCode> <ser:subscriber> <!--Required:--> <dat:MobilePhone>Mobile Number</dat:MobilePhone> <!--Optional:--> <dat:FName>First Name</dat:FName> <!--Optional:--> <dat:LName>Last Name</dat:LName> <!--Optional:--> <dat:Email>Email</dat:Email> <!--Optional:--> <dat:City>City</dat:City> <!--Optional:--> <dat:Street>Street 1</dat:Street> <!--Optional:--> <dat:Street2>Street 2</dat:Street2> <!--Optional:--> <dat:ZipCode>Zip code</dat:ZipCode> <!--Optional:--> <dat:CustomField1>Custom Field1</dat:CustomField1> <!--Optional:--> <dat:CustomField2>Custom Field2</dat:CustomField2> <!--Optional:--> <dat:CustomField3>Custom Field3</dat:CustomField3> <!--Optional:--> <dat:PrivateCode>Private Code</dat:PrivateCode> <!--Optional:--> <dat:UniqueID>Unique ID</dat:UniqueID> </ser:subscriber> </ser:UpdateSubscriberByOrg> </soapenv:Body> </soapenv:Envelope> Soap Response <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <UpdateSubscriberByOrgResponse xmlns="http://SBTService/ServiceContracts/"> <UpdateSubscriberByOrgResult 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>1013</a:ErrorCode> <a:Message>Subscriber information saved successfully</a:Message> <a:Result>true</a:Result> </UpdateSubscriberByOrgResult> </UpdateSubscriberByOrgResponse> </s:Body> </s:Envelope>
JAVA
SubscriberWSService srv = new SubscriberWSService(); ISubscriber iSubscriber = srv.getSubscriberWSServiceHttpEndpoint1(); WSSubscriberResponse res = null; String securityToken = "securityToken"; String orgCode = "Organization Code"; SubscriberInfo subscriber = new SubscriberInfo(); subscriber.setMobilePhone(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "MobilePhone"), new String("").getClass(),"1233456567768")); subscriber.setFName(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "FName"), new String("").getClass(),"FName")); subscriber.setLName(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "LName"), new String("").getClass(),"LName")); subscriber.setEmail(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "Email"), new String("").getClass(),"[email protected]")); subscriber.setStreet(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "Street"), new String("").getClass(),"Street")); subscriber.setStreet2(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "Street2"), new String("").getClass(),"Street2")); subscriber.setZipCode(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "ZipCode"), new String("").getClass(),"1234")); subscriber.setsetCustomField1(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "setCustomField1"), new String("").getClass(),"setCustomField1")); subscriber.setCustomField2(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "CustomField2"), new String("").getClass(),"CustomField2")); subscriber.setCustomField3(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "CustomField3"), new String("").getClass(),"CustomField3")); subscriber.setPrivateCode(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "PrivateCode"), new String("").getClass(),"PrivateCode")); subscriber.setUniqueID(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "UniqueID"), new String("").getClass(),"UniqueID")); try { res = iSubscriber.UpdateSubscriberByOrg(securityToken,orgCode, subscriber); } catch (Throwable e) { e.printStackTrace(); } if(res == null ){ System.out.println("::Error::"); 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("Message::"+res.getMessage().getValue()); }
PHP
<?php $client = new SoapClient("https://ui.solutionsbytext.com/Sbt.App.SetUp/wsservices/subscriberWSService.svc?wsdl"); $param = array( 'securityToken' =--> 'securityToken', 'orgCode' => 'Organization Code', 'subscriber ' => array( 'MobilePhone' => '123456789082', 'FName' => 'FName', 'LName' => 'LName', 'Email' => '[email protected]', 'City' => 'City', 'Street' => 'Street', 'Street2' => 'Street2', 'ZipCode' => '1235', 'CustomField1' => 'CustomField1', 'CustomField2' => 'CustomField2', 'CustomField3' => 'CustomField3', 'PrivateCode' => 'PrivateCode', 'UniqueID' => 'UniqueID', ) ); $response = $client->__soapCall('UpdateSubscriberByOrg', array($param)); echo '<pre?>'; print_r($response); if($response->UnpdateSubscribeByOrgResult->Result){ echo 'Message: '.$response->UnpdateSubscribeByOrgResult->Message; } else { echo 'Message: '.$response->UnpdateSubscribeByOrgResult->Message; } ?>
REST
Method: PUT
Sample C# Code:
SubscriberInfo subInfo = new SubscriberInfo { MobilePhone = "1234567891", FName = "FName", LName = "LName", Email = "[email protected]", City = "City", Street = "Street", Street2 = "Street2", ZipCode = "ZipCode", CustomField1 = "CustomField1", CustomField2 = "CustomField2", CustomField3 = "CustomField3", PrivateCode = "PrivateCode", UniqueID = "UniqueID" }; DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(SubscriberInfo)); MemoryStream mem = new MemoryStream(); ser.WriteObject(mem, subInfo); string data = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length); var requestdata = new { securityToken = "validsecurityToken", subscriber = subInfo }; 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 strUpd = webClient.UploadString("https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/SubscriberRSService.svc/UpdateSubscriber", "PUT", data2);
Response:
The response will be in JSON format like below: {" UpdateSubscriberByOrgResult": { "Result": true, "ErrorCode": 1013, "Message": " Subscriber information saved successfully" }}