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

1. Download the TaskMessenger client-side JAR using this link. This will download the TMAPI.jar

2. Include this JAR in your project in the libraries section.

3. You will also need to include json-simple in your project. You can download it using this link.

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.

package tmapitest;
import com.taskmessenger.api.sendtask.*; import java.util.ArrayList; import java.util.List;
public class TMAPITest {
public static void main(String[ ] args) {
// This is your API key, which can be found in the TaskMessenger app. String yourAPIKey = "ghytvYyh#cQJjU&LW35PgVg(htK*9H&";
// This is the actual task that you wish to send to the task recipients. Maximum of 6000 characters. String task = "This is the actual text of the task that will be sent to the task recipients.";
// This is the list of task recipients to whom you wish to assign this task. Obviously, this list cannot be null or empty, otherwise you will // receive an error. You can send a task to a maximum of 10 recipients. Recipient in the list after the first 10 are ignored. You can include // yourself in the recipients list as a task recipient. You are automatically considered the assigner of the task. List<String> taskRecipients = new ArrayList<>(); taskRecipients.add(""); taskRecipients.add("");
// Create the task configuration object. TaskConfig taskConfig = new TaskConfig(yourAPIKey, taskRecipients, task);
// Below is how you set a due date for the task. This field is optional. If your task does not have a due date, this can be omitted. The due date cannot be set // more than 14 days in the future. If it is, it will be truncated to 14 days from the delivery date. Also, the due date cannot be set for a time that is before the // send date. If it is, it will be ignored.
// The due date can be set in one of the following formats:
// US Format: mm/dd/yyyyhh:mm AM/PM Example: 06/01/2018 05:30 PM The due date is assumed to be in UTC time. // ISO 8601: yyyy-mm-dd hh:mm Example: 2018-06-01 17:30 The due date is assumed to be in UTC time. // From delivery time: XXdYYhZZm Example: 01d 05h 15m This example reads as one day, five hours, and fifteen minutes from time that the task is // sent. In this format, the dues date is the number of days, hours, and minutes from the time that the task is sent. So, in the example above, if you were to // send this task on a Monday at 9:00 AM, the task would be due Tuseday at 2:15 PM.
// The formats above must be followed precisely, spaces included, otherwise you will receive an error. taskConfig.setDueDate("06/23/2018 05:00 PM");
// Send the task. The send() method is guaranteed to not throw an exception. String response = new SendTask(taskConfig).send();
// The SendTask() response will be one of the following: // For success: { "success" : "sendTask" } // For failure: { "error" : "<the cause of the failure>" }