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

Using this method template messages can be sent to a single subscriber. Messages also can be sent to multiple subscribers but all should belong to the same group. Templates reside in the Group level.

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 allowed.

 

Syntax

C#

[OperationContractAttribute()]
SBT.API.DataContracts.MessageCenter.WSMessageResponse SendTemplateMessage(
   string securityToken,
   int templateID,
   List<WSRecipient> sendTo,
   string 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 for the message to be sent.

sendTo

- List <WSRecipient> (Required) - Recipient contains collection sentTo and customfields.
* SendTo - String[20] (Required) - SentTo for the subscriber (mobile phone number).
* List <CustomFields> (Optional) - Customfields contains collection of key - value pairs.

orgCode

- String[20] (Required) - Organization Code for the group that the message will be sent to .

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 errror 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.

 

Examples

C#

 MessageClient messageResult = new MessageClient("MessageWSServiceHttpEndpoint");
    string securityToken = txtToken.Text;
    int templateID;
    Int32.TryParse(txtTemplateID.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<WSRecipient> recipients = new List<WSRecipient>();
        WSRecipient recipient = new WSRecipient();
        recipient.SendTo = txtMobile.Text;
        recipient.CustomFields = customFields.ToArray();
        recipients.Add(recipient);

        string orgCode = txtOrgCode.Text;

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

    WSMessageResponse wSMessageResponse = messageResult.SendTemplateMessage(securityToken, templateID, recipients.ToArray(), orgCode, 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:SendTemplateMessage>
         <!--Required:-->
         <ser:securityToken>Security Token</ser:securityToken>
         <!--Required:-->
         <ser:templateID>unique Template ID</ser:templateID>
         <!--Required:-->
         <ser:sendTo>
            <!--Zero or more repetitions:-->
            <dat:WSRecipient>
               <!--Required:-->
               <dat:SendTo>Mobile Number</dat:SendTo>
               <!--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:WSRecipient>
         </ser:sendTo>
         <!--Required:-->
         <ser:orgCode>Group Org code</ser:orgCode>
         <!--Optional:-->
         <ser:note>custom note</ser:note>
         <!--Optional:-->
         <ser:statusUrl>Status URL</ser:statusUrl>
      </ser:SendTemplateMessage>
   </soapenv:Body>
</soapenv:Envelope>

   
   Soap Response
   
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <SendTemplateMessageResponse xmlns="http://SBTService/ServiceContracts/">
         <SendTemplateMessageResult 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>
         </SendTemplateMessageResult>
      </SendTemplateMessageResponse>
   </s:Body>
</s:Envelope>

JAVA

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

  String securityToken = "securityToken";
  Integer templateID = 101;
  ArrayOfWSRecipient sendTo = new ArrayOfWSRecipient();
  List  sendToList = new ArrayList ();
  WSRecipient recipient = new WSRecipient();
  recipient.setSendTo(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "SendTo"),
					new String("").getClass(),"1233445677889"));
  sendToList.add(recipient);
  sendTo.setWSRecipient(sendToList);
			
  String orgCode = "OrgCode";
  String note = "note";
  String statusUrl = "statusUrl";
	    
		 
  try {
		res = iMessage.sendTemplateMessage(securityToken, templateID, sendTo, 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',
	'sendTo' => array(
		'WSRecipient' => array(
			'CustomFields' => array(
				'CustomField' => array(
					'Key' => 'Name',
					'Value' => 'John',
				)
			),
			'SendTo' => '12345678999'
		)
	),
	'orgCode' => 'orgCode',
	'note' => 'test php code',
	'statusUrl' => 'statusUrl'
);

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

REST

Method: POST

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

Sample C# Code:

List<WSRecipient> listRecp = new List<WSRecipient>();
                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);

                WSRecipient recipient = new WSRecipient
                {
                    SendTo = "1245678910",
                    CustomFields = lstCustomFields
                };
                listRecp.Add(recipient);

                var requestdata = new
                {
                    securityToken = "validsecurityToken",
                    templateID = 12345,
                    sendTo = listRecp,
                    orgCode = "orgCode",
                    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 strSendTemplateMsgResponse = webClient.UploadString("https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/MessageRSService.svc/SendTemplateMessage", "POST", data2);
Note:“ strSendTemplateMsgResponse” contains the output response as return values 

Response:

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

 

 

Send Feedback