Follow the three steps below to prepare your project to use the TaskMessenger API.

1. Download the TaskMessenger client-side package using this link. This will download the tm-api module.

2. Include this package in your project in node_modules section.

3. You will also need to include config.json in root path of your project.


Once you have completed these three steps, you are ready to get started. The current version of the AIP only supports the assigning of text tasks. Future iterations will include support for audio, picture, and video tasks. The sample code below shows how to use the API to send tasks. The code comments provide additional details.

Index.js
"use strict" //required files and dependencies const request = require('request-promise') const config = require('./../../config.json')
//here is the request to create a task var requestOptions ={
headers: {
'type' : 'application/json', 'accept' : 'application/json'
}, url: `https://ziyzddn95e.execute-api.us-east-1.amazonaws.com/TMBundleAPIDeploymentStage/TMBundle`, json: {
// this config are filled in config.json file "action" : config.action, "apiKey" : config.apiKey, "taskType" : config.taskType, "dueDate" : config.dueDate, "task" : config.task, "caption" : config.caption, "taskRecipients" : config.recipients
}
};
//here the request to create a task is executed
exports.sendTask = function () {
request.post(requestOptions).then((response) => {
console.log(response);
});
}
config.json
{
"action" : "sendTask", "apiKey" : "ghytvYyh#cQJjU&LW35PgVg(htK*9H&", "taskType" : "text", "dueDate" : "06/01/2018 05:00 PM", "task" : "This is a another test task being set to you and me by Node.js", "caption" : "", "recipients" : [
"vincent@taskmessenger.com", "anthony@taskmessenger.com"
]
}