parseur.webhook

Classes

Module Contents

class parseur.webhook.Webhook[source]
classmethod from_response(data: Dict) Dict[source]

Deserialize a webhook API response.

Parameters:

data – Raw API response dictionary.

Returns:

Deserialized webhook dictionary.

classmethod create(event: parseur.event.ParseurEvent, target_url: str, mailbox_id: int | None = None, table_field_id: str | None = None, headers: Dict[str, str] | None = None, name: str | None = None) Dict[str, Any][source]

Create a new custom webhook for Parseur.

Parameters:
  • event – Webhook event type (document or table event).

  • target_url – The URL to send webhook POSTs to.

  • mailbox_id – Mailbox ID (required for document events).

  • table_field_id – Table field ID (required for table events, e.g. “PF12345”).

  • headers – Optional custom HTTP headers.

  • name – Optional custom name for the webhook.

Returns:

The created webhook object as a dictionary.

classmethod retrieve(webhook_id: int) Dict[str, Any][source]

Retrieve a webhook from the account.

Parameters:

webhook_id – ID of the webhook to delete.

Returns:

The updated mailbox object as a dictionary.

classmethod delete(webhook_id: int) bool[source]

Delete a webhook from the account.

Parameters:

webhook_id – ID of the webhook to delete.

Returns:

True if deletion was successful.

classmethod enable(mailbox_id: int, webhook_id: int) Dict[str, Any][source]

Enable an existing webhook for a given mailbox.

Parameters:
  • mailbox_id – ID of the mailbox.

  • webhook_id – ID of the webhook to enable.

Returns:

The updated mailbox object as a dictionary.

classmethod pause(mailbox_id: int, webhook_id: int) Dict[str, Any][source]

Pause (disable) an existing webhook for a given mailbox.

Parameters:
  • mailbox_id – ID of the mailbox.

  • webhook_id – ID of the webhook to pause.

Returns:

The updated mailbox object as a dictionary.

classmethod list() List[Dict[str, Any]][source]

Retrieve all webhooks as a list.

classmethod iter() Iterable[Dict[str, Any]][source]

Yield all webhooks registered on the account.