Skip to main content
Version: Next

Hooks

Let's talk about hooks. In the reecall ecosystem, you'll be able to subscribe to different events in order to execute different actions.

To do this, we need to create our first hook.

  • name: The hook name. It will be used in the various displays we provide.
  • events: The list of events to listen for this hook.
  • steps: The list of actions to be performed.
  • companyId: This defines which company I want to listen to. If not specified, events for the entire partner will trigger this hook.

Events

We're still working on the various events to expand the list. That's why only a few events are currently configurable.

  • conversation.created: Trigger when taking a call.
  • conversation.completed: This is triggered at the end of the call.
  • conversation.updated: This one every time the conversation is modified (i.e. at the end of the call).

Steps

For actions to be carried out afterwards, full documentation will be available shortly. At present, we recommend that you use this value by modifying the desired parameters ( endpoint, headers, ... ).

[
{
"type": "request",
"config": {
"url": "XXXXX", // endpoint to change
"method": "POST",
"headers": {
"Content-Type": "application/json",
},
"data": {
"rawData": "{{rawData}}" // you will receive a rawData object
}
}
}
]

Let's move on to the query

curl -X POST
-H "Authorization: Bearer <APIKEY>"
-H "Content-Type: application/json"
-d '{"name": "", "steps": [], "events": []}'
{{baseUrl}}/api/hooks

If your goal is to be notified when a conversation ends, I recommend you use the following request body:

{
"name": "My First Hook",
"companyId": "XXX",
"steps": [{
"type": "request",
"config": {
"url": "XXXXX", // endpoint to change
"method": "POST",
"headers": {
"Content-Type": "application/json",
},
"data": {
"rawData": "{{rawData}}" // you will receive a rawData object
}
}
}],
"events": ["conversation.completed"]
}

With the latter, you'll receive a notification at the end of each conversation, so you can do whatever you like with the data. You're free to add a companyId or not, so you can be more precise about which notifications you're interested in.