@eyedea-sockets/mailgun

0.0.1 • Public • Published

Syncano Socket for Mailgun

Syncano Socket CircleCI branch Codecov branch JavaScript Style Guide npm license

Main Socket features:

  • mailgun/send — send e-mail
  • mailgun/webhook — webhook for receiving e-mails via Mailgun

Getting Started

Install package in your project:

cd my_project
npm install @syncano/cli --save-dev
npm install @eyedea-sockets/mailgun --save
npx s deploy

Use it:

import Syncano from @syncano/client

const s = new Syncano(<instaneName>)

// E-mail params
const params = {
  to: 'john.doe@example.com'
  from: 'App admin <example@app.com>'
  subject: 'My awesome subject'
  html: '<h1>Email title</h1><p>Hello</p>'
}
const sendStatus = await s.post('mailgun/send', params)

Endpoints

mailgun/send

Input:

Parameter Type Description Example
to string Message recipient john.doe@example.com
from string Message sender App admin <example@app.com>
subject string Message subject My awesome subject
html string Message body in HTML <h1>Email title</h1><p>Hello</p>

Outputs:

success - Operation Successful

  • Code: 200
  • Mimetype: application/json
Parameter Type Description Example
message string Success message Message sent.

fail - Operation failed

  • Code: 400
  • Mimetype: application/json
Parameter Type Description Example
message string Invitation failed Internal error.

mailgun/webhook

Input:

Mailgun E-mail message payload. For more info check section "Parsed Messages Parameters" of Mailgun docs: https://documentation.mailgun.com/en/latest/user_manual.html#receiving-forwarding-and-storing-messages

Outputs:

success - Operation Successful

  • Code: 204
  • Mimetype: application/json

fail - Operation failed

  • Code: 400
  • Mimetype: application/json
Parameter Type Description Example
message string Operation failed Internal error.

Package Sidebar

Install

npm i @eyedea-sockets/mailgun

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

3.18 MB

Total Files

23

Last publish

Collaborators

  • hzub
  • maciejkorsan
  • idered
  • qk