Send an SMS Using C++

The TextMagic API C++ wrapper can save you a lot of time, as it includes all the necessary API commands and tests. It only takes a few seconds to download it from GitHub and to install it into your own app or software. After installation, you'll then be able to send text messages.

Get it now on GitHub
Cpp logo

Installation Instructions

You can clone the TextMagic API wrapper for C++ from the Github repository.

git clone git://

To make a static link library, run the following command:

make lib

If you want to try our examples, run the following command:

make all


The C++ wrapper for the TextMagic API has the following requirement:

  • gcc compiler v4.2.1 or higher

Get a contact by ID (an example)

Below is an example of how to get a single contact by ID using C++:

#include <iostream>
#include <textmagic.h>
Textmagic::Rest::RequestData vars;
Textmagic::Client tm("USERNAME", "API_KEY");
Textmagic::ContactModel contact = tm.Contacts().get("4379425", vars);
if (tm.Contacts().isError){
        << tm.Contacts().lastError.code << " * "
        << tm.Contacts().lastError.message << " * "
        << std::endl;
} else {
        << << " * "
        << contact.firstName << " * "
        << contact.customFields[3].value
        << std::endl;


If you need help with the wrapper, or if you have any suggestions for improvements and/or if you have any enquiries regarding the SMS API for C++, please contact us by emailing [email protected].