Skip to content

Latest commit

 

History

History
344 lines (228 loc) · 16.1 KB

README.md

File metadata and controls

344 lines (228 loc) · 16.1 KB

Webhooks

(webhooks)

Overview

Available Operations

create_webhook

Creates a new webhook

Example Usage

import moov
from moov import Moov
import os

s = Moov(
    gateway_auth=os.getenv("MOOV_GATEWAY_AUTH", ""),
)

res = s.webhooks.create_webhook(request={
    "url": "https://yearly-strategy.com/",
    "status": moov.Status.ENABLED,
    "event_types": [
        "<value>",
    ],
})

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
request models.CreateWebhook ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CreateWebhookResponse

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

list_webhooks

List all running webhooks

Example Usage

from moov import Moov
import os

s = Moov(
    gateway_auth=os.getenv("MOOV_GATEWAY_AUTH", ""),
)

res = s.webhooks.list_webhooks()

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListWebhooksResponse

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

get_webhook

Get webhook

Example Usage

from moov import Moov
import os

s = Moov(
    gateway_auth=os.getenv("MOOV_GATEWAY_AUTH", ""),
)

res = s.webhooks.get_webhook(webhook_id="ec7e1848-dc80-4ab0-8827-dd7fc0737b43")

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
webhook_id str ✔️ ID of the webhook ec7e1848-dc80-4ab0-8827-dd7fc0737b43
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetWebhookResponse

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

update_webhook

Update webhook

Example Usage

import moov
from moov import Moov
import os

s = Moov(
    gateway_auth=os.getenv("MOOV_GATEWAY_AUTH", ""),
)

res = s.webhooks.update_webhook(webhook_id="ec7e1848-dc80-4ab0-8827-dd7fc0737b43", update_webhook={
    "url": "https://pretty-battle.info/",
    "status": moov.Status.ENABLED,
    "event_types": [
        "<value>",
        "<value>",
    ],
})

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
webhook_id str ✔️ ID of the webhook ec7e1848-dc80-4ab0-8827-dd7fc0737b43
update_webhook models.UpdateWebhook ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.UpdateWebhookResponse

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

delete_hook

Delete webhook

Example Usage

from moov import Moov
import os

s = Moov(
    gateway_auth=os.getenv("MOOV_GATEWAY_AUTH", ""),
)

res = s.webhooks.delete_hook(webhook_id="ec7e1848-dc80-4ab0-8827-dd7fc0737b43")

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
webhook_id str ✔️ ID of the webhook ec7e1848-dc80-4ab0-8827-dd7fc0737b43
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeleteHookResponse

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

ping_webhook

Send a ping event to test if the webhook is setup correctly.

Example Usage

from moov import Moov
import os

s = Moov(
    gateway_auth=os.getenv("MOOV_GATEWAY_AUTH", ""),
)

res = s.webhooks.ping_webhook(webhook_id="ec7e1848-dc80-4ab0-8827-dd7fc0737b43")

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
webhook_id str ✔️ ID of the webhook ec7e1848-dc80-4ab0-8827-dd7fc0737b43
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.PingWebhookResponse

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

get_webhook_secret

Get secret to verify that a HTTP request came from Moov.

Example Usage

from moov import Moov
import os

s = Moov(
    gateway_auth=os.getenv("MOOV_GATEWAY_AUTH", ""),
)

res = s.webhooks.get_webhook_secret(webhook_id="ec7e1848-dc80-4ab0-8827-dd7fc0737b43")

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
webhook_id str ✔️ ID of the webhook ec7e1848-dc80-4ab0-8827-dd7fc0737b43
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetWebhookSecretResponse

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

list_event_types

Get a list of event types that a webhook can subscribe to. The list will be in alphabetical order based on the identifier. This endpoint should be available to Moov's customers.

Example Usage

from moov import Moov
import os

s = Moov(
    gateway_auth=os.getenv("MOOV_GATEWAY_AUTH", ""),
)

res = s.webhooks.list_event_types(webhook_id="ec7e1848-dc80-4ab0-8827-dd7fc0737b43")

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
webhook_id str ✔️ ID of the webhook ec7e1848-dc80-4ab0-8827-dd7fc0737b43
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListEventTypesResponse

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*