Skip to content

Latest commit

 

History

History
215 lines (139 loc) · 7.43 KB

README.md

File metadata and controls

215 lines (139 loc) · 7.43 KB

Webhooks

(webhooks)

Overview

Webhooks are a way for Shippo to notify your application when a specific event occurs. For example, when a label is purchased or when a shipment tracking status has changed. You can use webhooks to trigger actions in your application, such as sending an email or updating a database.

Webhook Payload

The payload is the body of the POST request Shippo sends to the URL specified at the time of webhook registration.

Available Operations

create_webhook

Creates a new webhook to send notifications to a URL when a specific event occurs.

Example Usage

import shippo
from shippo.models import components

s = shippo.Shippo(
    api_key_header='<YOUR_API_KEY_HERE>',
    shippo_api_version='2018-02-08',
)


res = s.webhooks.create_webhook(request=components.WebhookUpdateRequest(
    event=components.WebhookEventTypeEnum.BATCH_CREATED,
    url='https://example.com/shippo-webhook',
    active=True,
    is_test=False,
))

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
request components.WebhookUpdateRequest ✔️ The request object to use for the request.

Response

components.Webhook

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

list_webhooks

Returns a list of all webhooks you have created.

Example Usage

import shippo

s = shippo.Shippo(
    api_key_header='<YOUR_API_KEY_HERE>',
    shippo_api_version='2018-02-08',
)


res = s.webhooks.list_webhooks()

if res is not None:
    # handle response
    pass

Response

components.WebhookPaginatedList

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

get_webhook

Returns the details of a specific webhook using the webhook object ID.

Example Usage

import shippo

s = shippo.Shippo(
    api_key_header='<YOUR_API_KEY_HERE>',
    shippo_api_version='2018-02-08',
)


res = s.webhooks.get_webhook(webhook_id='<value>')

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
webhook_id str ✔️ Object ID of the webhook to retrieve

Response

components.Webhook

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

update_webhook

Updates an existing webhook using the webhook object ID.

Example Usage

import shippo
from shippo.models import components

s = shippo.Shippo(
    api_key_header='<YOUR_API_KEY_HERE>',
    shippo_api_version='2018-02-08',
)


res = s.webhooks.update_webhook(webhook_update_request=components.WebhookUpdateRequest(
    event=components.WebhookEventTypeEnum.BATCH_CREATED,
    url='https://example.com/shippo-webhook',
    active=True,
    is_test=False,
), webhook_id='<value>')

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
webhook_id str ✔️ Object ID of the webhook to retrieve
webhook_update_request components.WebhookUpdateRequest ✔️ N/A

Response

components.Webhook

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

delete_webhook

Deletes a specific webhook using the webhook object ID.

Example Usage

import shippo

s = shippo.Shippo(
    api_key_header='<YOUR_API_KEY_HERE>',
    shippo_api_version='2018-02-08',
)


s.webhooks.delete_webhook(webhook_id='<value>')

# Use the SDK ...

Parameters

Parameter Type Required Description
webhook_id str ✔️ Object ID of the webhook to delete

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*