Webhooks endpoint

Webhooks documentation

Fetch all webhooks

webhooks(project_id[, params = None])
Parameters:
  • project_id (str) – ID of the project

  • params (dict) – Pagination parameters

Returns:

Webhook collection

Example:

webhooks = client.webhooks('123.abc', {"page": 2, "limit": 2})
webhooks.items[0].webhook_id # => "0efe309..."

Fetch a single webhook

webhook(project_id, webhook_id)
Parameters:
  • project_id (str) – ID of the project

  • webhook_id (str) – ID of the webhook to fetch

Returns:

Webhook model

Example:

webhook = client.webhook('123.abc', "0efe...")
webhook.url # => "http://example.com/notify"
webhook.secret # => "xyz345890"

Create webhook

create_webhook(project_id, params)
Parameters:
  • project_id (str) – ID of the project

  • params (dict) – Webhook parameters

Returns:

Webhook model

Example:

webhook = client.create_webhook('123.abc', {
    "url": r"http://example.com/notify",
    "events": ["project.imported", "project.snapshot"]
})
webhook.url # => "http://example.com/notify"
webhooks.events # => ["project.imported", "project.snapshot"]

Update webhook

update_webhook(project_id, webhook_id[, params = None])
Parameters:
  • project_id (str) – ID of the project

  • webhook_id (str) – ID of the webhook to update

  • params (dict) – Webhook parameters

Returns:

Webhook model

Example:

webhook = client.update_webhook('123.abc', "0efe...", {
    "events": ["project.translation.updated"]
})
webhook.events # => ["project.translation.updated"]

Delete webhook

delete_webhook(project_id, webhook_id)

Example:

client.delete_webhook('123.abc', "0efe...")

Regenerate webhook secret

regenerate_webhook_secret(project_id, webhook_id)
Parameters:
  • project_id (str) – ID of the project

  • webhook_id (str) – ID of the webhook to regenerate secret for

Returns:

Dict with project ID and secret with the new secret’s value

Example:

resp = client.regenerate_webhook_secret('123.abc', "0efe...")
resp['secret'] # => "xyz123abc"