Introduction
Chakra allows you to listen to any kind of change in the system and read the same. The primary mechanism to do that is via webhooks. But before we dive into webhooks, a short note on the data model itself.
Data Model
Depending on the solution that you are using you may be dealing with typical record objects like Customers and process objects like Leads, Tickets - Or you might have custom objects tailor made for your solution.
Following are the major types of data in Chakra's system:
- Record
- Process
- Task
Relationship
A record is the most granular object that you can create. It has no state information.
Objects that need state information need to be modeled as Processes. A process is started against and completed against a record. Process has both a state field to capture granular state and also an overall status which can be OPEN/COMPLETED/CANCELLED
Finally, tasks capture granular user interactions against a process or a record or both.
Basic schema:
classDiagram
Process --> Record
Task --> Process
Task --> Record
Process: +json data
Process: +String status
Process: +State state
class Task{
+json data
+String status
}
class Record{
+json data
}
Example implementation:
classDiagram
Lead --> Customer
Call --> Lead
Call --> Customer
Lead: +json data
Lead: +String status
Lead: +State state
class Call{
+json data
+String status
}
class Customer{
+json data
}
data
Each of the data objects can store data as a key value pair of attribute ids and values as follows
{
"applicant_name": "Harish Test 674",
"lead_id": "EXT-TEST-674",
"utm_source": "google",
"weight": "146",
"existing_customer": true,
"google_coordinates": [
12.323333,
27.188833
],
"phone_number": "4400000091",
"source_lead_id": "87",
"otp_verified": "true",
"city": 1,
"loan_type": "fresh",
"pincode": "561892",
"loan_amount": 100000,
"customer_id": "dWWWdU-00000969",
"loan_start_time": "16 December,2019 11:00 AM"
}
The objects can have 0 to n attributes. meaning attributes need not be configured to create an object schema and new attribute can be added on the fly. This is helpful as the system makes no assumption about the inherent data being passed/stored in each of these objects.
More info can be found in the Data Model section
Outbound Webhooks
The easiest way to pass data from Chakra to your system is via outbound web hooks. Webhooks can be configured for the lifecycle events of the Objects described above. You can send all the events to your API or you can send events that satisfy any specific conditions.
graph LR
A0(Chakra) -->A
A[event] -->D[External Api 1]
A -->C[Lifecycle Rule 2]
C --> E[External Api 2]
D-->F1(Your System)
E-->F1
event
Following are the events available for web hooks
- Process
- process:create
- process:update
- process:state-change
- Task
- task:create
- task:update
- Record
- record:create
- Record:update
Lifecycle Rule
Lifecycle rules allow you to listen to specific events happening in the system. For example in stead of listening to all lead updates you could listen to only those leads which are getting converted.
The rule condition for this case would be state: CONVERTED
Lifecycle rules are the standard rule engine for all automations on the platform.
External API
As the name suggests these are external APIs that you can configure in the Chakra system. They can be linked to the webhook action of a lifecycle rule. This is what enables data to finally reach your systems. You need to defined the following for an External API:
-
Host
-
Path
-
Headers (including authorization headers)
-
Body (In case a of outbound webhooks it will be the entire event object itself)