# node-messenger-platform

> Facebook Messenger Platform node adapter.

Latest version **0.0.4** (published 2016-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-messenger-platform
pnpm add node-messenger-platform
yarn add node-messenger-platform
bun add node-messenger-platform
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2016-04-15 |
| First published | 2016-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Mark mail.ormark@gmail.com |
| Maintainers | shmuga |
| Keywords | node, facebook, messenger, bot, chat |

## Links

- npm: https://www.npmjs.com/package/node-messenger-platform
- Repository: https://github.com/shmuga/node-messenger-platform
- Homepage: https://github.com/shmuga/node-messenger-platform#readme
- Issues: https://github.com/shmuga/node-messenger-platform/issues
- npm.io page: https://npm.io/package/node-messenger-platform

## Dependencies (2)

- [ramda](https://npm.io/package/ramda.md) ^0.21.0
- [request-promise](https://npm.io/package/request-promise.md) ^2.0.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2016-04-15
- 0.0.3 — 2016-04-15
- 0.0.2 — 2016-04-15
- 0.0.1 — 2016-04-15

## README

#Facebook Messenger Platform

Node Facebook Messanger Platform adapter built with promises.   
Write your best chat bot using best async techology!

##Installation
```
npm install -S node-messenger-platform
```

##Usage

There are two types of usage this node module:

```javascript
  const FBPlatform = require('node-messanger-platform')
  
  // stateless usage
  FBPlatform.send(token, {id: '123'}, {text: 'hello'})
  FBPlatform.sendImage(token, recipient, message, notificationType)
  
  // or statefull usage
  const Bot = FBPlatform.Bot(token)
  Bot.send(recipient, message, notificationType)
```

##API Reference

* [FBPlatform](#TelegramBot)
    * .Bot
      * [new Bot(token)](#FBPlatform_bot)  ⇒ <code>Object</code>
    * [.send(token, recipient, message, [notificationType])](#FBPlatform+send) ⇒ <code>Promise</code>
    * [.sendImage(token, recipient, url, [notificationType])](#FBPlatform+sendImage) ⇒ <code>Promise</code>
  
<a name="FBPlatform_bot"></a>
###Bot

Statefull class for fb messanger platform usage. Stores token in object.

### new Bot(token)
Creates an instance of FBPlatform bot using token. 

<a name="FBPlatform+send"></a>
### .send(token, recipient, message, [notificationType])

Sending message using token to recipient. 

**Returns**: <code>Promise</code>   
**See**: https://developers.facebook.com/docs/messenger-platform/send-api-reference#request   


| Param | Type | Description |
| --- | --- | --- |
| token  | <code>String</code> | Facebook Messanger Platform token. |
| recipient | <code>Object</code> | Recipient object with `id` or `phone_number` fields |
| message | <code>Object</code> | Any message object from documentation. `message` is required property |
| [notificationType] | <code>String</code> | Notification type. Default `REGULAR` |

<a name="FBPlatform+sendImage"></a>
### .sendImage(token, recipient, url, [notificationType])

Sending images using token to recipient. 

**Returns**: <code>Promise</code>   
**See**: https://developers.facebook.com/docs/messenger-platform/send-api-reference#request   


| Param | Type | Description |
| --- | --- | --- |
| token  | <code>String</code> | Facebook Messanger Platform token. |
| recipient | <code>Object</code> | Recipient object with `id` or `phone_number` fields |
| url | <code>String</code> | Image url that you want to send. |
| [notificationType] | <code>String</code> | Notification type. Default `REGULAR` |

---
_Source: https://npm.io/package/node-messenger-platform · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
