copyright (C) 2019, MboateK. All rights reserved.
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.
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.
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.
