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

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 is used to send template messages to subscribers in a Group. Message will be sent to all active subscribers in the specified Group.

Notes:

A user (APIKey account) can make up to 10 parallel requests or use multiple threads concurrently.

For sending messages, a limit of 100 messages per request is Recommended.

 

Syntax

C#

[OperationContractAttribute()]
SBT.API.DataContracts.MessageCenter.WSMessageResponse SendTemplateMessageToOrg(
   string securityToken,
   int templateID,
   List<WSOrgRecipient> orgCode,
   string note,
   string statusUrl  
)

 

WSDL

 

Production: https://ui.solutionsbytext.com/Sbt.App.SetUp/WSServices/MessageWSService.svc?singlewsdl

Staging: https://test.solutionsbytext.com/Sbt.App.SetUp/WSServices/MessageWSService.svc?singlewsdl

 

Parameters

securityToken

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

templateID

- int (Required) – active Template ID of the message to be sent.

orgCode

* OrgCode - String[20] (Required) - Organization Code of the Group .
* List <CustomFields> (Optional) - Customfields contains collection of key - value pairs.

note

- String[500] (Optional) - This is a custom ID which is used to track the message transaction.

statusUrl

- String[200] (Optional) - Status URL that can be used to post message status information to a file.

 

Return Value

WSMessageResponse
NameTypeDescription
Result bool True/False whether the call was successful or not.
ErrorCode int For Success/Failure it will generate an error number
Message string Message related to the error code
TransactionTicket string ID created from message; this can be used in the 'Get Message Status' function to check the delivery status of the message.
Note string Note created from message; this can be used in the 'Get MessageStatusByNote' function to check the delivery status of the message.

 

Developer Tips

The SendTemplateMessageToOrg method includes an optional Note parameter. The Note field enables clients to pass data in conjunction with a message delivery attempt. When sending a message to an array of phone numbers, the note is associated with all messages in the request.

Examples of Note field utilization include:

  • Branch location associated with the customer account
  • Customer segmentation identifier
  • Combinations of data to uniquely identify the messages sent to customers

If a client Status URL is provided, the Note field data is posted to the client's Status URL with each real-time message delivery status update.

When the subscriber replies to the message, the Note field data will be posted to the client's Callback URL (if provided) along with the subscriber's response in real-time as well.

The Note field can be used with the GetMessageStatusByNote method to retrieve the status of sent messages using the Note data.

In addition, the API response when invoking SendTemplateMessageToOrg() includes a TransactionTicket. The TransactionTicket is unique for that request. The TransactionTicket issued for the request can be used with the GetMessageStatus method to retrieve the status of sent messages using the TransactionTicket.

 

Example

C#

MessageClient messageResult = new MessageClient("MessageWSServiceHttpEndpoint");
    string securityToken = txtToken.Text;
    int templateID;
    Int32.TryParse(txtTemplate.Text,out templateID);

    //Create custom fields             
        List<CustomField> customFields = new List<CustomField>();
        CustomField customField = new CustomField();
        customField.Key = txtKey.Text;
        customField.Value = txtValue.Text;
        customFields.Add(customField);

    //Create recipients  
        List<WSOrgRecipient> orgCodes = new List<WSOrgRecipient>();
        WSOrgRecipient wSOrgRecipient = new WSOrgRecipient();
        wSOrgRecipient.OrgCode = txtOrgCode.Text;
        wSOrgRecipient.CustomFields = customFields.ToArray();
        orgCodes.Add(wSOrgRecipient);

        string note = txtNote.Text;
        string statusUrl = txtStatusURL.Text;

    WSMessageResponse wSMessageResponse = messageResult.SendTemplateMessageToOrg(securityToken, templateID, orgCodes.ToArray(), note, statusUrl);
    //process response  
        if (!wSMessageResponse.Result)
            {
                //handle error      
                lblError.Text = wSMessageResponse.Message;
            }
        else
            {
                //handle success      
                lblError.Text = wSMessageResponse.Message;
            }

SOAP

Soap Request 
              
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://SBTService/ServiceContracts/" xmlns:dat="http://SBTAPIService/DataContract/" xmlns:ser1="http://schemas.microsoft.com/2003/10/Serialization/">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:SendTemplateMessageToOrg>
         <!--Required:-->
         <ser:securityToken>Security Token</ser:securityToken>
         <!--Required:-->
         <ser:templateID>Template ID</ser:templateID>
         <!--Required:-->
         <ser:orgCode>
            <!--Zero or more repetitions:-->
            <dat:WSOrgRecipient>
               <!--Required:-->
               <dat:OrgCode>Group Code</dat:OrgCode>
               <!--Optional:-->
               <dat:CustomFields>
                  <!--Zero or more repetitions:-->
                  <dat:CustomField>
                     <!--Optional:-->
                     <dat:Key>test key</dat:Key>
                     <!--Optional:-->
                     <dat:Value>test value</dat:Value>
                  </dat:CustomField>
               </dat:CustomFields>
            </dat:WSOrgRecipient>
         </ser:orgCode>
         <!--Optional:-->
         <ser:note>Custom Note</ser:note>
         <!--Optional:-->
         <ser:statusUrl>Status URL</ser:statusUrl>
      </ser:SendTemplateMessageToOrg>
   </soapenv:Body>
</soapenv:Envelope>
  
 Soap Response
 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <SendTemplateMessageToOrgResponse xmlns="http://SBTService/ServiceContracts/">
         <SendTemplateMessageToOrgResult 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>1281</a:ErrorCode>
            <a:Message>Message queued successfully</a:Message>
            <a:TransactionTicket>Transaction Ticket</a:TransactionTicket>
            <a:note>Custom Note</a:note>
         </SendTemplateMessageToOrgResult>
      </SendTemplateMessageToOrgResponse>
   </s:Body>
</s:Envelope>

JAVA

  MessageWSService srv = new MessageWSService();
  IMessage iMessage = srv.getMessageWSServiceHttpEndpoint1();
  WSMessageResponse res = null;

  String securityToken = "securityToken";
  Integer templateID = 101;
  ArrayOfWSOrgRecipient orgCode = new ArrayOfWSOrgRecipient();
  List<WSOrgRecipient> sendToList = new ArrayList<WSOrgRecipient>();
  WSOrgRecipient recipient = new WSOrgRecipient();
  recipient.setOrgCode(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "OrgCode"),
				new String("").getClass(),"OrgCode"));
  sendToList.add(recipient);
  orgCode.setWsOrgRecipient(sendToList);
		
  String note = "note";
  String statusUrl = "statusUrl";
		 
  try {
	   res = iMessage.sendTemplateMessageToOrg(securityToken, templateID, orgCode, note, statusUrl);

  } 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/MessageWSService.svc?wsdl");
  $param = array(
	'securityToken' => 'securityToken',
	'templateID' => '11',
	'orgCode' => array(
		'WSOrgRecipient' => array(
			'CustomFields' => array(
				'CustomField' => array(
					'Key' => 'Coupon Code',
					'Value' => '1234567',
				)
			),
			'OrgCode' => 'OrgCode'
		)
	),
	'note' => 'test php code',
	'statusUrl' => 'statusUrl'
);

$response = $client->__soapCall('SendTemplateMessageToOrg', array($param));
echo '<pre/>';
print_r($response);
if($response->SendTemplateMessageToOrgResult->Result){
	echo 'Message: '.$response->SendTemplateMessageToOrgResult->Message;
	echo '<br>';
	echo 'TransactionTicket: '.$response->SendTemplateMessageToOrgResult->TransactionTicket;
	echo '<br>';
	echo 'Note: '.$response->SendTemplateMessageToOrgResult->note;
}
else {
	echo $response->SendTemplateMessageToOrgResult->Message;
}


?>

REST

Method: POST

URL: https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/MessageRSService.svc/SendTemplateMessageToOrg

Sample C# Code:

List<WSOrgRecipient> listOrgRecp = new List<WSOrgRecipient>();
                List<CustomField> lstCustomFields = new List<CustomField>();
                CustomField customField1 = new CustomField
                {
                    Key = "Key1",
                    Value = "Value1"
                };
                lstCustomFields.Add(customField1);
                CustomField customField2 = new CustomField
                {
                    Key = "Key2",
                    Value = "Value2"
                };
                lstCustomFields.Add(customField2);

                WSOrgRecipient recipient = new WSOrgRecipient
                {
                    OrgCode = "OrgCode",
                    CustomFields = lstCustomFields
                };
                listOrgRecp.Add(recipient);

                var requestdata = new
                {
                    securityToken = "validsecurityToken",
                    templateID = 12345,
                    orgCode = listOrgRecp,                    
                    note = "sample note",
                    statusUrl = "sample statusUrl"
                };

                string data2 = JsonConvert.SerializeObject(requestdata).ToString();
                
                System.Net.WebClient webClient = new System.Net.WebClient();
                webClient.Headers["Content-type"] = "application/json";
                webClient.Encoding = Encoding.UTF8;
var strSendTemplateMsgToOrgResponse = webClient.UploadString("https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/MessageRSService.svc/SendTemplateMessageToOrg", "POST", data2);
Note:“strSendTemplateMsgToOrgResponse” contains the output response as return values 

Response:

The response will be in JSON format like below:

{" SendTemplateMessageResult": {
   "Result": true,
   "ErrorCode": 1281,
   "Message": " Message sent successfully",
   "TransactionTicket": "AA13J-0618V-15389-174L0",
   "Note": " Some Notes",
   }}

 

 

Send Feedback