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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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:

  1. Login to the Prembly Dashboard.
  2. Click on the 'SDK Library', then navigate to 'Webhook'
  3. 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)

ResponseDescription
statusIndicates that the request was successful.
detailIndicates the detail of the response.
response_codeResponse code indicating the outcome of verification.
dataPlaceholder for verification data.
face_dataFace matching data.
StatusIndicates that the face matching process was successful.
detailDetailed information about the face match.
response_codeResponse code for face matching.
confidenceConfidence level associated with the face match.
widget_infoWidget information.
emailEmail associated with the widget.
first_nameFirst name associated with the widget.
last_nameLast name associated with the widget.
user_refUser reference associated with the widget.

Response Description (API Webhook)

ResponseDescription
statusIndicates that the request was successful.
detailIndicates the detail of the response.
response_codeResponse code indicating the outcome of verification.
dataPlaceholder for verification data.

You can override your webhook on the dashboard to receive verification result in a webhook of choice.

Include "callback_url" in the payload of any of our endpoints to utilize this feature. Ensure the callback_url value is a valid URL; otherwise, the system will disregard it and won't send the webhook response to the invalid URL. If the URL is invalid, the response will instead be sent to the webhook URL linked to the organization's account (if applicable).