An open API service indexing awesome lists of open source software.

https://github.com/eyedea-io/syncano-socket-mailgun

Syncano Socket for Mailgun
https://github.com/eyedea-io/syncano-socket-mailgun

mail mailbox mailgun serverless syncano syncano-socket

Last synced: 10 months ago
JSON representation

Syncano Socket for Mailgun

Awesome Lists containing this project

README

          

# Syncano Socket for Mailgun

[![Syncano Socket](https://img.shields.io/badge/syncano-socket-blue.svg)](https://syncano.io)
[![CircleCI branch](https://img.shields.io/circleci/project/github/eyedea-io/syncano-socket-mailgun/master.svg)](https://circleci.com/gh/eyedea-io/syncano-socket-mailgun/tree/master)
![Codecov branch](https://img.shields.io/codecov/c/github/eyedea-io/syncano-socket-mailgun/master.svg)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![npm](https://img.shields.io/npm/dw/@eyedea-sockets/mailgun.svg)](https://www.npmjs.com/package/@eyedea-sockets/)
![license](https://img.shields.io/github/license/eyedea-io/syncano-socket-mailgun.svg)

Main Socket features:

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

## Getting Started

Install package in your project:

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

Use it:

```js
import Syncano from '@syncano/client'

const s = new Syncano()

// E-mail params
const params = {
to: 'john.doe@example.com'
from: 'App admin '
subject: 'My awesome subject'
html: '

Email title

Hello

'
}
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 ` |
| subject | string | Message subject | `My awesome subject` |
| html | string | Message body in HTML | `

Email title

Hello

` |

#### 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.` |