Loader

Query message status

 

Overview

This command returns the status of a message. You can query the status with either the apimsgid or climsgid. The API Message ID (apimsgid) is the message ID returned by the gateway when a message has been successfully submitted. If you specified your own unique client message ID (climsgid) on submission, you may query the message status using this value.

Messages can be queried up to six days after it was sent. After this time this command may not be able to find the message.

Note: Clickatell can also send message status updates to your application via means of a Callback URL. This is the recommended method to obtain message status updates as your application is not required to continually poll the Clickatell gateway. Detailed information can be found on the Callback page.

 
Command
querymsg

 

Parameters
  • You need to supply the authentication parameters that are outlined in the Getting Started Page.
  • You need to pass either apimsgid or climsgid.

Parameter

Description

apimsgid

This is the API message ID you get back when you send a message.

climsgid

This is the message ID that you specified when you generated a message.

 
Examples

All examples below are for the document/literal based server.

1
2
3
4
5
6
7
8
9
10
11

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.clickatell.com/soap/document_literal/webservice">
    <soap-env:body>
        <ns1:querymsg>
            <api_id>123456</api_id>
            <user>MyUsername</user>
            <password>MyPassword</password>
            <apimsgid>57809dfd9296c9df57c84c16d69ceeef</apimsgid>
        </ns1:querymsg>
    </soap-env:body>
</soap-env:envelope>

 

Code samples:
PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

<?php
$oClient new SoapClient(
    'http://api.clickatell.com/soap/document_literal/webservice?wsdl',
        array(
        'trace' => true,
        'keep_alive' => true
        )
);
 
// Query message
$aResult $oClient->querymsg(
    array(
    'api_id' => '123456',
    'user' => 'MyUsername',
    'password' => 'MyPassword',
    'apimsgid' => '57809dfd9296c9df57c84c16d69ceeef'
    )
);
 
echo '

' . print_r($aResult,true) . '

1

'; ?>

 

API responses
Example response

Successful API response:

1
2
3
4
5
6
7
8

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.clickatell.com/soap/document_literal/webservice">
    <soap-env:body>
        <ns1:querymsgresponse>
            <return>ID: 57809dfd9296c9df57c84c16d69ceeef Status: 004</return>
        </ns1:querymsgresponse>
    </soap-env:body>
</soap-env:envelope>

Error response

1
2
3
4
5
6
7

<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.clickatell.com/soap/document_literal/webservice">
    <soap-env:body>
        <ns1:querymsgresponse>
            <return>ERR: 001, Authentication failed</return>
        </ns1:querymsgresponse>
    </soap-env:body>
</soap-env:envelope>

Return format

Successful API response:

ID: <message ID> Status: <status ID>

Error response:

ERR: <error code>, <error description>

Did you find this information informative?

Other Resources

Ask the Community

Visit Stack Overflow to join our community of developers and find the answer you need

Contact Support

Contact our support team and one of our agents will be in touch with you to answer any questions you have