Webhooks
A webhook is a mechanism that allows one software application to send real-time data to another application or service whenever a specific event occurs. It enables real-time communication between different systems by triggering an action when a predefined event takes place.
Here's a breakdown of how webhooks work and their key components:
- Event Source: The event source is the application or service that generates events and triggers actions. For example, this could be a user action on a website, a new post on a social media platform, or a data update in a database.
- Webhook Endpoint: The webhook endpoint is the URL of the receiving application or service that will handle the incoming data. This endpoint is provided by the recipient and typically exposes an API or HTTP endpoint to accept incoming data.
- Registration: To set up a webhook, the event source needs to be configured to send data to the webhook endpoint. This often involves providing the endpoint URL to the event source and specifying the events that should trigger the webhook.
- Event Occurrence: When the specified event occurs in the event source, the source application sends an HTTP POST request to the webhook endpoint. This request contains the relevant data related to the event.
- Webhook Processing: The receiving application (webhook consumer) processes the incoming data and takes appropriate actions based on the event. This can involve data processing, updating records, triggering notifications, or performing any other necessary operation.
- Response: After processing the incoming data, the webhook consumer typically responds to the webhook source with a status code or confirmation message to indicate that the data was received and processed successfully.
- Real-Time Interaction: Webhooks enable real-time interactions because the event source triggers the webhook immediately upon the event's occurrence. This contrasts with polling, where the recipient continuously checks the source for new data.
How to set it up
To set up your company's webhook endpoint, follow these steps:
- Login to the Peleza Dashboard.
- Click on the 'SDK Library', then navigate to 'Webhook'
- Add your webhook URL and click on 'Update Webhook.'
Once successfully saved, this enables us to notify you whenever events occur on your account through the webhook URL. We will use the response received from our service provider, and you can then proceed to process it from your end.
Sample SDK response
{
"status":true,
"detail":"Verification Successful",
"response_code":"00",
"data":{
// Verification data will be here"
},
"face_data":{
"Status":true,
"detail":"Face match",
"response_code":"00",
"confidence":"95.3"
},
"widget_info":{
"email":"[email protected]",
"first_name":"test",
"last_name":"test",
"user_ref":"12345678909"
}
}
Sample API Webhook response
{
"status": true,
"detail": "Verification Successfull",
"response_code": "00",
"data": {
........
}
}
Response Description (SDK)
Response | Description |
---|---|
status | Indicates that the request was successful. |
detail | Indicates the detail of the response. |
response_code | Response code indicating the outcome of verification. |
data | Placeholder for verification data. |
face_data | Face matching data. |
Status | Indicates that the face matching process was successful. |
detail | Detailed information about the face match. |
response_code | Response code for face matching. |
confidence | Confidence level associated with the face match. |
widget_info | Widget information. |
Email associated with the widget. | |
first_name | First name associated with the widget. |
last_name | Last name associated with the widget. |
user_ref | User reference associated with the widget. |
Response Description (API Webhook)
Response | Description |
---|---|
status | Indicates that the request was successful. |
detail | Indicates the detail of the response. |
response_code | Response code indicating the outcome of verification. |
data | Placeholder for verification data. |
Updated over 1 year ago