typesend/mailgun_webhook_auth
{ "createdAt": "2016-02-14T22:04:01Z", "defaultBranch": "master", "description": "A Plug for validating Mailgun Webhook requests in Elixir applications", "fullName": "typesend/mailgun_webhook_auth", "homepage": "", "language": "Elixir", "name": "mailgun_webhook_auth", "pushedAt": "2016-02-15T00:26:10Z", "stargazersCount": 2, "topics": [], "updatedAt": "2017-08-15T13:01:11Z", "url": "https://github.com/typesend/mailgun_webhook_auth"}MailgunWebhookAuth
Section titled “MailgunWebhookAuth”This is a Plug module for validating Mailgun Webhook requests in Elixir applications.
A 403 Unauthorized Webhook Request response is returned for all invalid requests. All other requests pass through unmodified.
Installation
Section titled “Installation”Add mailgun_webhook_auth to the deps function in your project’s mix.exs file:
defp deps do [{:mailgun_webhook_auth, "~> 1.0"}]endThen run mix do deps.get, deps.compile inside your project’s directory.
Recommended usage is within a pipeline, but it may be used within your Phoenix controllers; anywhere a Plug can be used.
It expects your private mailgun API token String to be passed at initialization.
Example Phoenix.Router
Section titled “Example Phoenix.Router”pipeline :webhooks do plug MailgunWebhookAuth, api_token: Application.get_env(:your_application, :mailgun_key)end
scope "/webhooks", YourApplication do pipe_through :webhooks
post "/received", WebhookController, :received post "/delivered", WebhookController, :delivered post "/dropped", WebhookController, :dropped post "/bounced", WebhookController, :bounced post "/complaints", WebhookController, :complaints post "/unsubscribes", WebhookController, :unsubscribes post "/clicks", WebhookController, :clicks post "/opens", WebhookController, :opensendExample Mix.Config
Section titled “Example Mix.Config”config :your_application, mailgun_key: "key-BLAHBLAHBLAH"Mailgun Documentation
Section titled “Mailgun Documentation”See the Mailgun Routes documentation for more information.
License
Section titled “License”MailgunWebhookAuth uses the same Apache 2 license as Plug and the Elixir programming language. See the license file for more information.