Webhook Notification Integration
A guide to setting up your integration with Accredits webhook notification service.
Accredit provides webhook event notifications to keep clients informed about various events within the system. This guide outlines how to integrate your application with Accredit's webhook notifications.
Integration Steps
To integrate your application with Accredit's webhook notifications, follow these steps:
-
Check Available Subscription Events: Using the
GET /api/webhookSubscription/events
endpoint, you can check which subscription events are available for your use. -
Create Webhook Subscription: Then, using the
POST /api/webhookSubscription
endpoint, create a new subscription for your chosen event. Take note of the returnedSignature Key
for request signature verification. -
Register Endpoint: Ensure your application exposes an endpoint to receive webhook notifications, like the
/baseWebhookNotification
example provided below. -
Trigger Example Notification: Using the
POST /api/webhookSubscription/triggerSampleEventNotification
endpoint, trigger an example notification using your chosen event and URL to test your endpoint. -
Handle Signatures: Validate the
X-Signature
header to ensure the authenticity of incoming requests. Accredit's webhook notifications use SHA-256 with RSA for request signing.
For further information on request signing, please refer to the Request Signature Verification Guide. -
Process Notifications: Depending on the subscription event, the request body will vary. Ensure your endpoint is configured to handle the appropriate schema.
-
Handle Retries: Accredit allows up to 5 retry attempts for failed notifications. Consider implementing retry logic based on the
X-JobAttempt
andX-JobId
headers, to avoid processing requests multiple times. -
Respond Appropriately: Respond with an appropriate HTTP status code, such as 200 for successful processing or 400 for a bad request. Note that returning a 400 triggers a retry.
Example Endpoint
Endpoint: /baseWebhookNotification
/baseWebhookNotification
This endpoint receives notifications based on the subscribed event.
- Method: POST
- Headers:
X-Signature
: Base64 encoded request signature generated using SHA-256 with RSA.X-JobId
: ID of the notification job for reference.X-JobAttempt
: Attempt number of the current notification job. 0 is the initial attempt, with up to 5 retries.
- Request Body: JSON payload containing notification details. Below is an example with base fields, additional fields depend on the subscribed event:
{
"Event": "Entity.Event",
"Timestamp": "2024-05-10T11:09:21.248Z"
}
- Response Codes:
- 200: OK
- 400: Bad Request
Request Body Schema
Please refer to the list of potential schemas, dependent upon the notification event.
Conclusion
By following these integration steps and leveraging Accredit's webhook notifications, you can keep your application synchronized with events occurring within the Accredit system efficiently.
For further assistance, refer to Accredit's API documentation or contact support.
Updated about 1 year ago