Skip to content

mksms/mksms-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RapidJSON logo

A very lightweight C++ library for communicating with the MKsms API

copyright (C) 2019, MboateK. All rights reserved.

Introduction

Compatibility

Mksms-cpp intends to be a cross-platform. For the moment it only has been tested on GNU C++ 7.4.0

Users can build and run the unit test on their platform/compiler.

Installation

Mksms-cpp is a header only C++ library. Just copy the mksms-cpp/include folder's content into your system or project's include path.

Example of usage

This simple example shows how to create a client, start verification, confirm verification send and receive text messages through the Mksms's API.

#include "mksms-cpp/mksms.hpp"
#include <string>

using namespace mksms;

int main(){

    const string api_hash("73249341d85f566b6f2b8cef4563d6c149efe4df2b43f21776a6c9faf7f61af9");
    const string api_key("830EA3BB2F");
    const string name("Jon Doe");
    const string number("690932122");

    //1. Create a Client object
    Client client(api_key, api_hash);

    //2. Start verification of the client
    Response<string> res = client.start_verify(number, name);

    //3. Confirm the verification of the client
    Response<string> resp = client.confirm_verify(number, name);


    //4. Create a Contact to whom you will send a message
    Contact contact("Tamo", "657818877");

    //5. Create a Message to be sent
    Message message(contact, "Hello world!", Direction::OUT, false);

    //6. Send a message
    client.send_message(message);

    //7. Receive messages
    time_t date();
    time_t time_stamp();
    Response<vector<Message>> response = client.getMessages(date, mksms::Direction::IN, false, time_stamp);

    return 0;
}

Note that this example did not handle potential errors.

About

The C++ client library for MKSms API

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages