(webhooks)
Set up webhooks to notify your backend of events within Bolt. These webhooks can communicate with your OMS or other systems to keep them up to date with Bolt. See our related guide on Webhooks.
Find webhook configurations belonging to a merchant division. Results are limited to only show webhooks authorized by the X-API-Key.
from bolt_api_sdk import Bolt, models
import os
with Bolt(
security=models.Security(
x_api_key=os.getenv("BOLT_X_API_KEY", ""),
),
) as bolt:
res = bolt.webhooks.query_webhooks(division_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
division_id |
str |
✔️ |
The unique ID associated to the merchant's Bolt Account division; Merchants can have different divisions to suit multiple use cases (storefronts, pay-by-link, phone order processing). You can view and switch between these divisions from the Bolt Merchant Dashboard. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.QueryWebhooksResponse
| Error Type |
Status Code |
Content Type |
| errors.ErrorsBoltAPIResponse |
400, 403, 404 |
application/json |
| errors.APIError |
4XX, 5XX |
*/* |
Create a new webhook to receive notifications from Bolt about various events, such as transaction status. Webhooks must have unique configuration.
from bolt_api_sdk import Bolt, models
import os
with Bolt(
security=models.Security(
x_api_key=os.getenv("BOLT_X_API_KEY", ""),
),
) as bolt:
res = bolt.webhooks.create_webhook(request={
"division_id": "3X9aPQ67-YrB",
"url": "https://eva-nerv.shop.com/path/to/hook",
})
# Handle response
print(res)
models.CreateWebhookResponse
| Error Type |
Status Code |
Content Type |
| errors.ErrorsBoltAPIResponse |
400, 403, 422 |
application/json |
| errors.APIError |
4XX, 5XX |
*/* |
Delete a Bolt webhook. Provide an authorized X-API-Key to perform this action.
from bolt_api_sdk import Bolt, models
import os
with Bolt(
security=models.Security(
x_api_key=os.getenv("BOLT_X_API_KEY", ""),
),
) as bolt:
bolt.webhooks.delete_webhook(webhook_id="wh_za7VbYcSQU2zRgGQXQAm-g")
# Use the SDK ...
| Parameter |
Type |
Required |
Description |
Example |
webhook_id |
str |
✔️ |
Webhook ID |
wh_za7VbYcSQU2zRgGQXQAm-g |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
| Error Type |
Status Code |
Content Type |
| errors.ErrorsBoltAPIResponse |
400, 403, 404 |
application/json |
| errors.APIError |
4XX, 5XX |
*/* |
Get Webhook information by its Webhook ID. Results only include webhooks authorized by the X-API-Key.
from bolt_api_sdk import Bolt, models
import os
with Bolt(
security=models.Security(
x_api_key=os.getenv("BOLT_X_API_KEY", ""),
),
) as bolt:
res = bolt.webhooks.get_webhook(webhook_id="wh_za7VbYcSQU2zRgGQXQAm-g")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
webhook_id |
str |
✔️ |
Webhook ID |
wh_za7VbYcSQU2zRgGQXQAm-g |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.Webhook
| Error Type |
Status Code |
Content Type |
| errors.ErrorsBoltAPIResponse |
400, 403, 404 |
application/json |
| errors.APIError |
4XX, 5XX |
*/* |