Skip to main content

Create Process API

The following APIs allow you to create a single process. Examples of a process are models like Lead, Ticket and Fieldvisit

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

Create A Process

POST /v1/ext/procedure/<procedure short id>/process

You can find the short id for the procedure from the procedures details page (available in admin)

Following are valid examples of the path

PUT /v1/ext/procedure/lead/process
PUT /v1/ext/procedure/ticket/process
PUT /v1/ext/procedure/fieldvisit/process

Request Body

The API accepts a json request body

{
"data": {
"firstname": "Ted",
"lastname": "Mosby",
"score": 5
},
"record": {
"data": {
"phone_number": "7701214822",
"email": "ted.mosby@yahoo.com"
}
},
"status": "COMPLETED",
"state": "CONVERTED",
"nextActionAt": 1618558867539,
"assignedTo": "bcc42c4f-3e9c-4eaa-8728-c1edd7c7be5c"
}

data - should be an object. keys should be attribute short ids. value should denote the update value for the provided attribute

record - the record for which this process is getting created. For example lead process usually get created for a customer record. So you need to define the record info (usually data) inside the record json

status - the updated status of the process - can be one of OPEN, COMPLETED or CANCELLED.

state - the updated state - the list of possible states depends on the procedure to which this process belongs

nextActionAt - accepts a unix epoch timestamp in milliseconds. This value updates the nextActionAt field of a process

Example

curl --request GET \
--url https://api.chakrahq.com/v1/ext/procedure/lead/process \
--header 'authorization: Bearer <your_access_token>' \
--header 'Content-Type: application/json' \
--data '{
"data": {
"firstname": "Ted",
"lastname": "Mosby",
"score": 5
},
"record": {
"data": {
"phone_number": "7701214822",
"email": "ted.mosby@yahoo.com"
}
},
"status": "COMPLETED",
"state": "CONVERTED",
"nextActionAt": 1618558867539,
"assignedTo": "bcc42c4f-3e9c-4eaa-8728-c1edd7c7be5c"
}'

Attribute specific data

Depending on your attribute type you have to pass the value in the specific format in the data field.

Attribute TypeData Format
External ObjectPass a json object exactly matching the external object schema
PhotoPass a photo id generated after uploading a photo via the upload photo API