From cb5dacb5582cbec0cf3f178ab6e983759ec9fb9d Mon Sep 17 00:00:00 2001 From: Alex Lebedev <6421109+alex-leb@users.noreply.github.com> Date: Tue, 26 May 2026 16:29:28 +0300 Subject: [PATCH] DE-1784: Account Webhooks - Add docs Signed-off-by: Alex Lebedev <6421109+alex-leb@users.noreply.github.com> --- README.md | 1 + docs/AccountWebhooks.md | 55 +++++++++++++++++++++++++++++++++++++++++ docs/Webhooks.md | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 docs/AccountWebhooks.md diff --git a/README.md b/README.md index 4ad3e3a..e87ea6d 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,7 @@ This SDK includes the following components: - [Opt-In Handler](docs/OptInHandler.md) - [Domains](docs/Domains.md) - [Webhooks](docs/Webhooks.md) +- [Account Webhooks](docs/AccountWebhooks.md) - [Events](docs/Events.md) - [Snippets](docs/Snippets.md) - [Subaccounts](docs/Subaccounts.md) diff --git a/docs/AccountWebhooks.md b/docs/AccountWebhooks.md new file mode 100644 index 0000000..ea8c929 --- /dev/null +++ b/docs/AccountWebhooks.md @@ -0,0 +1,55 @@ +Mailgun - Account Webhooks +==================== + +This is the Mailgun Ruby *Account Webhook* utilities. + +The below assumes you've already installed the Mailgun Ruby SDK in to your +project. If not, go back to the master README for instructions. + +Usage - Account Webhooks +----------------------- + +```ruby +# First, instantiate the Mailgun Client with your API key +mg_client = Mailgun::Client.new('your-api-key') +hook = Mailgun::AccountWebhooks.new(mg_client) + +``` + +Account Webhooks methods: + +```ruby +# List account-level webhooks +hook.list +hook.list('id1, id2') + +# Create an account-level webhook +hook.create( + description: 'desc', + event_types: 'accepted', + url: 'https://the.webhook.url/' +) + +# Delete account-level webhooks +hook.remove(all: true) +hook.remove('id1, id2') + +# Get account-level webhook by ID +hook.get('id1') + +# Update an account-level webhook +hook.update( + 'hook', + description: 'desc', + event_types: 'accepted', + url: 'https://the.webhook.url/' +) + +# Delete account-level webhook by ID +hook.remove_by_id('id1') +``` + +More Documentation +------------------ +See the official [Mailgun Account Webhooks Docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/account-webhooks) +for more information diff --git a/docs/Webhooks.md b/docs/Webhooks.md index b81e138..ad54303 100644 --- a/docs/Webhooks.md +++ b/docs/Webhooks.md @@ -38,5 +38,5 @@ hook.remove_all 'my.perfect.domain' More Documentation ------------------ -See the official [Mailgun Domain Docs](https://documentation.mailgun.com/en/latest/api-webhooks.html) +See the official [Mailgun Webhooks Docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-webhooks) for more information