Using the Test Message Flag on SCG API messages


At some point in the implementation of a client application, there will be a QA phase. This includes integration testing and running code and API calls on the client's test infrastructure.

The SCG API facilitates this testing phase by allowing users to submit test message requests without sending the actual messages, over the production communication network, to the destination phone numbers and without the need to change a single byte of code in client development.

This document provides usage examples of the field "test message flag", which allows to send text messages via the SCG API without sending the actual messages to the destination numbers.


Using the “test_message_flag” field

The “test_message_flag” field is a Boolean field. When set to true messages are created in SCG but are NOT sent to the destination number(s) specified in the API request. This allows users to test the API calls without incurring on real charges for submitting the message. Users can validate if a message is a test message or not by querying the status of the message. If the message is a test message, its status is displayed as ‘TEST’. You can use the SCG portal’s Messages Reports or the GET method of the API to query the status of the message,

When set to false, messages are sent to the destination number(s) specified in the API request

Considering that test messages are not sent to the mobile network operators, there are no charges related to any TEST message.

If the customer’s developer uses a variable to set this flag value, then it is possible to avoid any change in the programming code as only a change in the variable stored value is needed to set the execution in test mode.


API calls examples

Messages call:

curl -L -X POST 
-H "Content-Type: application/json" -H "Authorization: Bearer <TOKEN>"
-d "{\"from\":\"channel:1KJPMkuHQkair_o15exxxx\", \"to\":\"+1346787XXXX\",
\"body\":\"This is a test message.\", \"test_message_flag\":true}"


Message_Request call:

curl -L -X POST 
-H "Content-Type: application/json" -H "Authorization: Bearer <TOKEN>"
-d "{\"from\":\"channel:1KJPMkuHQkair_o15etpmg\", \"to\":[\"+1346787XXXX\", \"+1747255XXXX\"],
\"body\":\"This is a test message 2.\", \"test_message_flag\":true}"


Reports / Messages



Was this article helpful?
0 out of 0 found this helpful


Please sign in to leave a comment.