Loader

Query message status and charge

 

Overview

This command returns the status and charge of a message. You can query the status with the apimsgid. The API Message ID (apimsgid) is the message ID returned by the gateway when a message has been successfully submitted.

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
getmsgcharge

 

Parameters

Parameter

Description

apimsgid

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

 
Examples
Request data sample

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:getmsgcharge>
            <api_id>123456</api_id>
            <user>MyUsername</user>
            <password>MyPassword</password>
            <apimsgid>8d5ea83833d3c0c139ffcf3d285fdec4</apimsgid>
        </ns1:getmsgcharge>
    </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
        )
);
 
$aResult $oClient->getmsgcharge(
    array(
        'api_id' => '123456',
        'user' => 'MyUsername',
        'password' => 'MyPassword',
        'apimsgid' => '8d5ea83833d3c0c139ffcf3d285fdec4'
    )
);
 
echo '<pre>' . print_r($aResult,true) . '</pre>';
?>

 
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:getmsgchargeresponse>
            <return>apiMsgId: 8d5ea83833d3c0c139ffcf3d285fdec4 charge: 0.33 status: 004</return>
        </ns1:getmsgchargeresponse>
    </soap-env:body>
</soap-env:envelope>

Error 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:getmsgchargeresponse>
            <return>ERR: 001, Authentication failed</return>
        </ns1:getmsgchargeresponse>
    </soap-env:body>
</soap-env:envelope>

 

Return format

Successful API response:

apiMsgId: <message ID> charge: <charge> 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