(Webhooks)
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.
The payload is the body of the POST request Shippo sends to the URL specified at the time of webhook registration.
Creates a new webhook to send notifications to a URL when a specific event occurs.
using Shippo;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
WebhookUpdateRequest req = new WebhookUpdateRequest() {
Event = Shippo.Models.Components.WebhookEventTypeEnum.BatchCreated,
Url = "https://example.com/shippo-webhook",
Active = true,
IsTest = false,
};
var res = await sdk.Webhooks.CreateWebhookAsync(req);
// handle response
Parameter |
Type |
Required |
Description |
request |
WebhookUpdateRequest |
✔️ |
The request object to use for the request. |
Webhook
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Returns a list of all webhooks you have created.
using Shippo;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.Webhooks.ListWebhooksAsync();
// handle response
WebhookPaginatedList
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Returns the details of a specific webhook using the webhook object ID.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.Webhooks.GetWebhookAsync(webhookId: "<id>");
// handle response
Parameter |
Type |
Required |
Description |
WebhookId |
string |
✔️ |
Object ID of the webhook to retrieve |
Webhook
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Updates an existing webhook using the webhook object ID.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.Webhooks.UpdateWebhookAsync(
webhookId: "<id>",
webhookUpdateRequest: new WebhookUpdateRequest() {
Event = Shippo.Models.Components.WebhookEventTypeEnum.BatchCreated,
Url = "https://example.com/shippo-webhook",
Active = true,
IsTest = false,
}
);
// handle response
Parameter |
Type |
Required |
Description |
WebhookId |
string |
✔️ |
Object ID of the webhook to retrieve |
WebhookUpdateRequest |
WebhookUpdateRequest |
✔️ |
N/A |
Webhook
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Deletes a specific webhook using the webhook object ID.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
await sdk.Webhooks.DeleteWebhookAsync(webhookId: "<id>");
// handle response
Parameter |
Type |
Required |
Description |
WebhookId |
string |
✔️ |
Object ID of the webhook to delete |
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |