fastify-mailgun

1.0.0 • Public • Published

fastify-mailgun

Travis Codacy Badge Known Vulnerabilities Coverage Status Greenkeeper badge js-standard-style

Fastify plugin that adds MailGun support with incoming webhooks. Under the hood the mailgun-js module is used.

Installation

$ npm install fastify-mailgun

Usage

fastify.register(require('fastify-mailgun'), {
    prefix: '/mailgun', // register your webhook (in MailGun) with '/mailgun/webhooks'
    apiKey: 'apikey-...', // your MailGun API Key
    domain: 'mydomain.com',  // you domain name
    webhookHandler: async function (data) {
      // handle you webhook data
 
      // example: retrieve the message from mailgun store
      const storedMessage = await fastify.mailgun.getStoredMessage({ url: data.storage.url })
 
      // example: send a new mail using the mailgun client
      await fastify.mailgun.client.messages().send(...)
 
      return true
    }
  })

Maintainers

Osmond van Hemert Github Web

Contributing

If you would like to help out with some code, check the details.

Not a coder, but still want to support? Have a look at the options available to donate.

License

Licensed under MIT.

/fastify-mailgun/

    Package Sidebar

    Install

    npm i fastify-mailgun

    Weekly Downloads

    4

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    25.7 kB

    Total Files

    18

    Last publish

    Collaborators

    • ovhemert