Chat Bridge
Chat Bridge is an npm package that simplifies the integration of Facebook Messenger webhook handling into your Node.js applications. It offers a convenient way to interact with the Messenger Platform, handling incoming messages, postbacks, quick replies, and more.
| Installation | Features | Basic Usage | Documentation | Credits | License |
Installation
npm install @onyx/chat-bridge
Warning: This package is still in development and is not yet ready for production use.
Features
- Easy Integration: Quickly integrate Facebook Messenger webhook handling into your Node.js applications with minimal setup.
- Message Handling: Simplifies the handling of incoming messages, postbacks, quick replies, and more from the Messenger Platform.
- Event-based Architecture: Utilizes an event-based architecture for handling different Messenger events, providing a clean and modular structure.
Basic Usage
const { Client } = require("@onyx/chat-bridge");
const client = new Client({
accessToken: 'YOUR_ACCESS_TOKEN',
verifyToken: 'YOUR_VERIFY_TOKEN',
});
client.on("message", (event) => {
const { sender, message } = event;
const { text } = message;
const { id } = sender;
client.sendTextMessage(id, `You wrote: ${text}`);
});
client.start(async () => console.log(`Listening on ${client.page.name} (${client.page.id})`));
For detailed documentation, please refer to the Documentation page.
Credits
- Fastify - Fast and low overhead web framework, for Node.js
- Undici - An HTTP/1.1 client, written from scratch for Node.js
License
This project is licensed under the MIT License - see the LICENSE file for details.