Core SDK

The make-traffic-integration-core package provides the TaskManagerApp class — the main entry point for all integration functionality.

Initialization

import { TaskManagerApp } from 'make-traffic-integration-core';

const taskManager = new TaskManagerApp({
  apiUrl: 'YOUR_API_URL',
  appKey: 'YOUR_APP_KEY',
});

await taskManager.init();
Config option
Type
Description

apiUrl

string

The platform API endpoint. Found in Settings → Integration in the console.

appKey

string

Your application's unique identifier. Found in Settings → Integration in the console.

Methods

init()

async init(): Promise<void>

Initializes the library. Must be called once before any other method. Establishes the connection to the platform.


getTasks(userID)

Returns the list of tasks available for the given user. Call this to populate task lists in your UI.

Parameter
Type
Description

userID

string

A stable identifier for the current user in your system.


goProcess(userID, task)

Records that the user has started the task. Call this when the user takes the initial action associated with a task.

Parameter
Type
Description

userID

string

The current user's identifier.

task

Task

The task object returned from getTasks.


claimProcess(userID, task)

Records that the user has completed the task and claims the reward. Call this when the user finishes the task's required action.

Parameter
Type
Description

userID

string

The current user's identifier.

task

Task

The task object returned from getTasks.


subscribe(event, callback)

Subscribes to a task lifecycle event. Use this to react to task state changes in your UI — for example, showing a success message when a task is claimed.


unsubscribe(event, callback)

Removes a previously registered event listener. Always unsubscribe when the component or view that registered the listener is unmounted.

Usage example


See Events Reference for all available events.

Last updated