Webhook class

Send event notifications with webhooks using the SDK.


Overview

The Webhook data class allows you to create, view, test, and modify webhooks to create custom event notifications.

Webhook class attributes
AttributeDescription
urlstr | required
The URL of the webhook.
namestr | required
The name of the webhook.
eventslist[str] | required
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.
secretstr
The secret used to generate webhook signatures.
idstr
The webhook ID.
created_atstr
The timestamp when the webhook was created.
updated_atstr
The timestamp when the webhook was last updated.

Webhook class properties
PropertyDescription
infodict | deprecated
A dictionary representation of webhook attributes.
webhook_idstr | deprecated
The webhook ID. Use the id attribute instead.

all

The all class method allows you to view all webhooks in your workspace.

The returned data type is List["Webhook"].

An example with all

Python

    up42.Webhook.all()

  

delete

The delete instance method allows you to delete a registered webhook.

An example with delete

Python

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

webhook.delete()

  

get

The get class method allows you to retrieve a specific webhook by its ID.

The returned data type is Webhook.

An example with get

Python

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

  

get_webhook_events

The get_webhook_events class method returns all available webhook events.

The returned data type is list[dict].

An example with get_webhook_events

Python

    up42.Webhook.get_webhook_events()

  

save

The save instance method allows you to register a created or updated webhook in the system.

An example with save

Python

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

  

trigger_test_events

The trigger_test_events instance method allows you to trigger 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.

The returned data type is dict.

An example with trigger_test_events

Python

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

webhook.trigger_test_events()

  

update

The function is deprecated.

The update instance method allows you to modify a specific webhook.

The returned data type is dict.

An example with update

Python

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

webhook.update(
    name="new-name",
    url="https://new-receiving-url.com",
    events=["order.status"],
    active=True,
    secret="RFZTJnNAChqZKNmo",
)

  

A button link with the "View repository" text on it