Using actions in React Native SDK

An action represents a pickup, delivery, visit or any other transaction event being performed by the User. In this guide, we will cover how to use actions via the React Native SDK.

This guide assumes you have completed the basic integration and set a user id in the SDK.

Step 1: Assign actions to a user

Create and assign an Action object to the user. The createAction method accepts a js dictionary object with the following keys.

Key Value
expected_place_id UUID string of the Place where the Action is to be completed.
type Can be any of the action types.
unique_id Local identifier for the Action object, passed as string.
expected_at ISO datetime string which represents expected completion time.
var params = {
  'expected_place_id': '8166a3c6-5a55-42be-8c04-d73367b0ad9c',
  'expected_at': '2017-07-06T01:00:00.000Z',
  'unique_id': 'order-id-1435223'
}

RNHyperTrack.createAction(params).then(
    (success) => {
        // success callback
        console.log(success);
    }, (error) => {
        // error callback
        console.log(error);
    }
);

Step 2: View dashboard

Once you have assigned an action, run your app on a device. You would be able to view the action being performed on the ACTIONS tab on Dashboard.

Step 3: Complete an action

Use the completeActionInSync method to mark an action as completed.

RNHyperTrack.completeActionInSync(actionId).then(
    (success) => {
        // success callback
        console.log(success);
    }, (error) => {
        // error callback
        console.log(error);
    }
);

results matching ""

    No results matching ""