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 GitHubInstallation Instructions
You can clone the Textmagic API wrapper for C++ from the Github repository.
git clone git://github.com/textmagic/textmagic-cpp.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
Requirements
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){ std::cout << tm.Contacts().lastError.code << " * " << tm.Contacts().lastError.message << " * " << std::endl; } else { std::cout << contact.id << " * " << contact.firstName << " * " << contact.customFields[3].value << std::endl; }
Support
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].