Webhook
Use a webhook to keep track of changes in verification statuses of your user's addresses.
Integration steps
# | Required | Step |
0 | Required | |
1 | Required | |
2 | Optional | |
3 | Required | |
4 | Optional |
1. Configure a webhook listener
A webhook listener is a server that listens at a specific URL for incoming HTTP POST notification messages that are triggered when a status change event occurs.
See example below
Webhook timeouts
Webhook timeouts When OkHi sends an event to a webhook endpoint, the service must respond within 15 seconds. If OkHi does not receive a response within that period, the system logs a timeout error and retries the event later.
Destination endpoint APIs have fluctuations in availability due to a number of issues ranging from network failures to overload to bugs. OkHi’s internal systems retry failed destination API calls for few minutes with an exponential backoff after each attempt. This substantially improves delivery rates.
Take note that, in the event of a timeout error, where the destination API endpoint does process the event beyond the set time out window. When OkHi retries the event later, the destination API endpoint will end up with a duplicate event.
2. Test your webhook (optional)
Once you have configured your webhook, test it by making a POST
request to your webhook similar to the example below. See description of the JSON body parameters here.
Deprecation notice:
There will be some extra data, that is not documented above, in the payload that is sent to your webhook. Do not add logic that relies on the extra data that is not documented here as the extra fields will be deprecated soon.
Next, subscribe your listener to events.
3. Subscribe to events
To register your webhook listener for events, access OkDash by logging in and then click on the profile icon located at the top-right corner. After that, select "settings" and proceed to enter your webhook URL.
4. Validate your webhook using real-time data
Use the verification status simulator API for this.
After successfully subscribing your webhook listener to events, put it to the test by creating a new address and initiating verification. Your webhook will then receive notifications as intended and demonstrate its expected functionality.
Congratulations!
You have a basic webhook endpoint ready to accept verification events from OkHi. Now add the application logic that your business needs to handle the events you care the most about. You can also extend the endpoint with the steps below to verify the authenticity of the requests.
Secure your webhook
You can verify webhook event notifications that your listener receives when events occur. To verify event notifications, add a custom header to your webhook. We will then send the custom header along with each webhook event and you can validate the events based on correctness of the custom header.
JSON Body Parameters
Name | Type | Description |
v2.address_verification_id | String | Every address verification request will generate a unique alphanumeric identifier. Unique to the verification window + address ID |
v2.verification_status | String | |
v2.verification_mode | String | Value is either going to be:
|
v2.user_id | String | OkHi user ID unique to the user |
v2.location_id | String | OkHi address ID unique to the address |
Deprecation notice:
There will be some extra data, that is not documented above, in the payload that is sent to your webhook. Do not add logic that relies on the extra data that is not documented here as the extra fields will be deprecated soon.
Last updated