Overview
This method returns the status of a message transaction by using the transaction ticket that is generated when a message is sent through all the send message APIs. When you send a message via sendMessage, sendMessageTemplate, the response contains a field called transaction ticket – this is the unique identifier for the particular transaction of sending a message. With this transaction ticket, you can use getMessageStatus to identify the current status of the message.
Syntax
C#
[OperationContractAttribute()] SBT.API.DataContracts.MessageCenter.WSTransactionResponse GetMessageStatus( string securityToken, string transactionTicketId, string orgCode, string sentTo )
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.
transactionTicketId
– String[50] (Required)- String[50] (Required) -When a message has been sent, transactionTicketId is generated and available in the response.
orgCode
– String[20] (Required) – Organization Code used when sending message – Organization, Division or Group.
sentTo
– String[20] (Required) Mobile phone number that the message was sent to.
Return Value
WSTransactionResponse
Name | Type | Description |
---|---|---|
Result | bool | True/False whether the call was successful or not. |
ErrorCode | int | For Success/Failure it generates error number. |
Message | string | Message related to the error code |
Response | List <TransactionDetail> | Transaction details will be displayed if available. * SendTo – Mobile phone number message was sent to. * StatusCode – Status code of the message delivery (see Status Codes page) * StatusMessage – Message that correlates to status code. |
Developer Tips
When invoking the SendMessage, SendTemplateMessage, or SendTemplateMessageToOrg methods, the API response will include 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.
While the final delivery status of messages over a given time period is provided in reports, the delivery status of individual messages can be retrieved via the GetMessageStatus API method.
Examples
C#
MessageClient messageResult = new MessageClient("MessageWSServiceHttpEndpoint"); string securityToken = txtToken.Text; string transactionTicketId = txtTransactionTciket.Text; string orgCode = txtOrgCode.Text; string sentTo = txtMobileNo.Text; WSTransactionResponse wSTransactionResponse = messageResult.GetMessageStatus(securityToken, transactionTicketId, orgCode, sentTo); if (!wSTransactionResponse.Result) { //handle error lblError.Text = wSTransactionResponse.Message; } else { //handle success lblError.Text = wSTransactionResponse.Message; }
SOAP
Soap Request <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://SBTService/ServiceContracts/"> <soapenv:Header/> <soapenv:Body> <ser:GetMessageStatus> <!--Required:--> <ser:securityToken>Security Token</ser:securityToken> <!--Required:--> <ser:transactionTicketId>Transaction ticket ID</ser:transactionTicketId> <!--Required:--> <ser:orgCode>Org Code</ser:orgCode> <!--Required:--> <ser:sentTo>Phone Number</ser:sentTo> </ser:GetMessageStatus> </soapenv:Body> </soapenv:Envelope> Soap Response <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <GetMessageStatusResponse xmlns="http://SBTService/ServiceContracts/"> <GetMessageStatusResult 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>1238</a:ErrorCode> <a:Message>Successfully retrieved Message Status</a:Message> <a:Response> <a:TransactionDetail z:Id="i2"> <a:SendTo>Phone Number</a:SendTo> <a:StatusCode>100</a:StatusCode> <a:StatusMessage>Message was successfully delivered</a:StatusMessage> </a:TransactionDetail> </a:Response> <a:Result>true</a:Result> </GetMessageStatusResult> </GetMessageStatusResponse> </s:Body> </s:Envelope>
JAVA
MessageWSService srv = new MessageWSService(); IMessage iMessage = srv.getMessageWSServiceHttpEndpoint1(); WSTransactionResponse res = null; String securityToken = "securityToken"; String orgCode = "orgCode"; String sentTo = "12345678901"; String transactionTicketId = "li"; try { res = iMessage.getMessageStatus(securityToken, transactionTicketId, orgCode, sentTo); } 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', 'transactionTicketId' => 'transactionTicketId', 'orgCode' => 'orgcode', 'sentTo' => '12345678999', ); $response = $client->__soapCall('GetMessageStatus', array($param)); echo '<pre/>'; print_r($response); if($response->GetMessageStatusResult->Result){ echo 'Message: '.$response->GetMessageStatusResult->Message; } else { echo 'Message: '.$response->GetMessageStatusResult->Message; } ?>
REST
Method: GET
Response:
The response will be in JSON format like below: {" GetMessageStatusResult": { "Result": true, "ErrorCode": 1238, "Message": " Successfully retrieved Message Status", “Response”: { “List<TransactionDetail> response – SendTo,StatusCode,StatusMessage Information will display” } }}