Webhooks

Create and manage notification events using the SDK.


Overview

A webhook is a method for sending event notifications from one application to another. When something happens in a source system indicated by an event, the webhook transmits an event notification through HTTPS to a specific URL.

You can set up webhooks to receive notifications for order status updates.

View repository

Class: Webhook

A data class that represents a webhook in the system.

Attributes
AttributeDescription
urlstr
The URL of the webhook.
namestr
The name of the webhook.
eventsList[str]
A list of events that trigger the webhook. To view the list of possible values, use get_webhook_events.
activebool
Whether this webhook should be active after the update:
  • True: the webhook is active.
  • False: the webhook isn’t active.
The default value is False.
secretOptional[str]
The secret used to generate webhook signatures.
idOptional[str]
The webhook ID.
created_atOptional[str]
The timestamp when the webhook was created.
updated_atOptional[str]
The timestamp when the webhook was last updated.

Functions

save

Registers a created or updated webhook in the system.

Python

    webhook = up42.Webhook(
  name="A webhook for order updates",
  url="https://receiving-url.com",
  events=["order.status"],
  active=True
)

webhook.save()

  

get

Retrieves a specific webhook by its ID. Returns Webhook.

ParameterDescription
webhook_idstr
The webhook ID.

Python

    up42.Webhook.get(webhook_id="d290f1ee-6c54-4b01-90e6-d701748f0851")

  

trigger_test_events

Triggers a webhook test event to test your receiving side. The UP42 server will send test messages for each subscribed event to the specified webhook URL. Returns dict.

Python

    webhook = up42.Webhook(
  name="A webhook for order updates",
  url="https://receiving-url.com",
  events=["order.status"],
  active=True
)

webhook.trigger_test_events()

  

delete

Deletes a registered webhook. Returns None.

Python

    webhook = up42.Webhook.get(webhook_id="d290f1ee-6c54-4b01-90e6-d701748f0851")

webhook.delete()

  

get_webhook_events

Retrieves all available webhook events. Returns list[dict].

Python

    up42.Webhook.get_webhook_events()

  

all

Retrieves all webhooks in your workspace. Returns List["Webhook"].

Python

    up42.Webhook.all()

  

Learn more