About Webhooks
Webhooks allow customers and 3rd parties to monitor specific events of interest within the CredoAI platform, enabling automated data transfers to your server as events occur.
Utilizing webhooks eliminates the need for repetitive API polling to verify data presence. Once configured, webhooks ensure timely data delivery, eliminating the need for further intervention.
Webhooks can be effectively employed to track updates to use cases, new task assignments, and status updates for reviews, enhancing operational efficiency and responsiveness.
Webhook testing user flow:
-
Generate a URL using your existing event server, or if you do not have on, via Svix Playground
-
Create a webhook using a POST request in Postman. The POST request should include configuration information such as the url of your event server and the event_type subscriptions.
-
Make changes in the app that correspond to the events you subscribed to
-
View payload of event and change in Svix Playground
Configuring Webhooks
Note: this guide assumes that you are familiar with the CredoAI API and already know how to handle authentication with the platform.
Webhooks can be created and managed via the CredoAI API. When creating your webhooks, you will need to provide information such as the URL endpoint you need to hit, the event types that you want to trigger the webhook, and possibly authentication information, depending on your setup.
This is an example of a typical request used to create a webhook:
POST /api/v2//webhooks
Event Types
In the CredoAI platform, Webhooks support a variety of event types.
Use Case Events
Use Case Metadata Updated
event_type_format: use_case_#{metadata_entity}_updated
Triggers when metadata has been updated. Possible use case metadata entities include:
-
governance_status:
use_case_governance_status_updated
-
risk_category_level:
use_case_risk_category_level_updated
-
name:
use_case_name_updated
-
icon:
use_case_icon_updated
-
description:
use_case_description_updated
-
industries:
use_case_industries_updated
-
regions:
use_case_regions_updated
-
ai_type:
use_case_ai_type_updated
-
is_vendor:
use_case_is_vendor_updated
-
questionnaire_ids:
use_case_questionnaire_ids_updated
In the given example, governance_status
has been updated. This example responds to an event_type
called use_case_governance_status_updated
.
Custom Field Updated
event_type_format: use_case_custom_field_updated
Triggers when custom metadata is updated. customFieldId
can be used to determine what custom field has been updated. In this case, a custom field called "Target Review Date" with an ID of qPSHywBSDF9HXwBVvrwKJ2
has been updated.
Use Case Review Events
Use Case Review Comment
event_type_format: use_case_review_comment
Triggers when a comment is added to a review, or when a comment on a review is replied to. This example responds to an event_type
defined as use_case_review_comment
.
Use Case Review Status Update
event_type_format: use_case_review_status_update
Triggers when a use case review is created, or when it’s status is updated
Use Case Review Task Events
Use Case Review Task Status Updated
event_type_format: use_case_review_task_status_updated
Triggers when the status of a use case review task is updated.
Use Case Review Task Deleted
event_type_format: use_case_review_task_deleted
Triggers when a use case review task is deleted.
Testing your Webhooks
Before relying on your webhooks, it’s important that you test your configuration.
Step 1: Configuring your test endpoint
Note: If you already have an event server setup, you can test with that. Skip to Step 2 and use that as your url. Otherwise, follow Step 1 to configure a test endpoint.
-
Navigate to Svix Playground
-
Click “Start Now”
-
Bookmark the current page, and copy the value shown here. You will use this as the url when configuring your webhook in Step 2
Step 2: Creating your webhook
Using the new url from your new test endpoint or existing event server, create your webhook via the API described above. You will need to authenticate and following similar practices to other APIs in the CredoAI API.
If you are using a test endpoint from Svix Playground, you can set “authentication_type” to “none”. Otherwise, if you are using your own event server, set the authentication information appropriately.
You can use any valid event types to test your webhook, but a good one to test with is “use_case_governance_status_updated”.
Step 3: Make a change to your use case
Assuming that you set “use_case_governance_status_updated” as an event type, you can test by navigating to the Use Case Settings page, updating the governance status for the use case, and then changing it back.
Step 4: View the results
If you used an existing event server, confirm that the appropriate message was received by your server. If you’re using Svix Playground, return the URL that you bookmarked in Step 1. You should see one or more new messages in the top left corner. Click on one of the messages to see the payload.