Skip to main content

Bulk Update Process API

The following API allows you to update multiple processes in a single API call. This API is asynchronous - meaning the request is accepted and an acknowledgment is returned while the updates are carried out in the background. Use this api when you have to update 1000s of processes in one go.

Note all the apis accept api key based token authentication and return data within the wrapper {_data:{}, _meta: {}, _errors:[]}

Example:

curl --request PATCH \
--url https://api.chakrahq.com/v1/ext/procedure/tele_sales/process \
--header 'Authorization: Bearer <your_access_token>' \
--data '{
"processes": [
{
"lead_id": "EXT-TEST-143",
"update": {
"data": {
"score": "105"
}
}
},
{
"id": "1e50dd73-9ce6-405b-932a-9c4c5e7b5599",
"update": {
"data": {
"city": "Goa"
},
"state": "IN_PROGRESS"
}
}
]
}'

API

PATCH /v1/procedure/<procedure id or shortId>/process

Following are valid examples of the path

PATCH /v1/procedure/7a409cf7-5529-4570-9085-90798d7eb742/process

PATCH /v1/procedure/tele_sales/process

In the 1st example we have use the procedure id. Whereas in the second example we have used the procedure shortId - tele_sales.

Request Body

In the request body you need to pass a list of processes which are to be updated. Each update item will need the following parts

Process Identifier

A way to identify the process which needs to be updated. The identifier can be the process id or the process primary key

Eg:

"id": "LEAD-001"
"phone_number": "9901258433"

Where phone_number is the primary key for the corresponding procedure

update

The actual update to be made. The update inputs need to be encapuslated and sent against the key "update". Supported parameters that can be updated are

  • data - a json object composed of attribute shortIds and the values that are to be updated

    Eg:

    {
    "data": {
    "score": 42,
    "city": "Bangalore",
    "name": "Shane Warne"
    }
    }
  • state - the process state

    Eg:

    {
    "state": "IN_PROGRESS"
    }
  • status - the process status

    Eg:

    {
    "status": "CANCELLED"
    }

    status can be one of OPEN, COMPLETED, CANCELLED

  • assignedTo - who the process is assignedTo

    Eg:

    {
    assignedTo: "shane.warne"
    }
  • nextActionAt - the nextActionAt timestamp in epoch milliseconds

    Eg:

    {
    "nextActionAt": 1616253910842
    }
  • isDeleted - set isDeleted to true to delete a process

    Eg:

    {
    "isDeleted": true
    }

Following are valid examples of the request body

{
"processes": [
{
"id": "46ce67e5-684e-4cfc-b47e-345a485d1cdd",
"state": "IN_PROGRESS",
"status": "OPEN",
"assignedTo": "shane.warne",
"nextActionAt": "1616253910842",
"data": {
"first_name": "shane",
"last_name": "warne"
}
}
]
}
{
"processes": [
{
"lead_id": "LEAD-910",
"data": {
"country": "Japan",
"city": "Tokyo"
}
}
]
}
{
"processes": [
{
"status": "COMPLETED"
}
]
}