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

Using this method, messages can be sent to a single subscriber or multiple subscribers but all subscribers should belong to the same 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 SendMessage(
   string securityToken,
   string message,
   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

message

- String[160] (Required)- Content of the Message to be sent.

sendTo

- List <WSRecipient> (Required) - Recipient contains collection of sentTo and customfields.
* SendTo - String[20] (Required) -Subscriber number to which the message is to be sent (mobile phone number).
* List <CustomFields> (Optional) - Customfields contains collection of key - value pairs.

orgCode

- String[20] (Required) - Default code of the group where the subscriber is opted-in

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 generates 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 Custom note entered by user while sending message; this can be used in the GetMessageStatusByNote function to check the delivery status of the message.

 

Examples

C#

MessageClient messageResult = new MessageClient("MessageWSServiceHttpEndpoint");
    string securityToken = txtToken.Text;
    string message = txtMessage.Text;

        //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.SendMessage(securityToken, message, 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:SendMessage>
         <!--Required:-->
         <ser:securityToken>Security token</ser:securityToken>
         <!--Required:-->
         <ser:message>Message content</ser:message>
         <!--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>test custom note</ser:note>
         <!--Optional:-->
         <ser:statusUrl>Status URL</ser:statusUrl>
      </ser:SendMessage>
   </soapenv:Body>
</soapenv:Envelope>

   
 Soap Response
             
             
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <SendMessageResponse xmlns="http://SBTService/ServiceContracts/">
         <SendMessageResult 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 for tracking</a:TransactionTicket>
            <a:note>Custom note field</a:note>
         </SendMessageResult>
      </SendMessageResponse>
   </s:Body>
</s:Envelope>

JAVA

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

  String securityToken = "securityToken";
  String message = "message";
  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.sendMessage(securityToken, message, 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 (Example 1: Send Single Message)

<?php 
    $client = new SoapClient("<< Send Message WSDL URL -->>");
   $param = array(
   'securityToken' => 'securityToken',
   'message' => 'This is a test message [PHP Code]',
   '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('SendMessage', array($param));
echo '<pre?>';
print_r($response);
if($response->SendMessageResult->Result){
	echo 'Message: '.$response->SendMessageResult->Message;
	echo '<br>';
	echo 'TransactionTicket: '.$response->SendMessageResult->TransactionTicket;
	echo '<br>';
	echo 'Note: '.$response->SendMessageResult->note;
}
else {
	echo $response->SendMessageResult->Message;
}
?>

PHP (Example 2: Send Multiple Message with Multiple Variables)

<?php 
   $client = new SoapClient("<< Send Message WSDL URL -->>");
   $param = array(
   'securityToken' => 'securityToken',
   'message' => 'This is a test message [PHP Code] - from {FromName} to {ToName}',
   'sendTo' => array(
   'WSRecipient' => array(
   array(
   'CustomFields' => array(
                'CustomField' => array(
                    array(
                        'Key' => 'FromName',
                        'Value' => 'SBT User1'),
                    array(
                        'Key' => 'ToName',
                        'Value' => 'John')
                )
            ),
            'SendTo' => '12312312345'
        ),
        array(
            'CustomFields' => array(
                'CustomField' => array(
                    array(
                        'Key' => 'FromName',
                        'Value' => 'SBT User1'),
                    array(
                        'Key' => 'ToName',
                        'Value' => 'Albert')
                )
            ),
            'SendTo' => '12341234123'
        )
        )
    ),
    'orgCode' => 'orgCode',
    'note' => 'test php code',
    'statusUrl' => 'statusUrl''
);

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

REST

Method: POST

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

JSON Request:

{"securityToken":"Security Token",
   "message":"Test message from {CustomVariable1} REST { CustomVariable2}",
   "sendTo":[{"SendTo":"Phone1","CustomFields":[{"Key":" CustomVariable1","Value":"value1"},{"Key":" CustomVariable2","Value":"value2"}]},{"SendTo":"Phone2","CustomFields":[{"Key":" CustomVariable1","Value":"value1"},{"Key":" CustomVariable2","Value":"value2"}]}],
   "orgCode":"Default Org. Code",
   "note":"Custom Note",
   "statusUrl":"Status URL"
}

Response:

The response will be in JSON format like below:

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

 

Send Feedback