1.0.0 • Published 5 months ago

flowchat-messenger-sdk v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Messenger SDK

A SDK for FlowChat Messenger.

Installation

npm install messenger-sdk

Usage

const { FlowChatMessenger } = require('messenger-sdk');

const options = {
  chatbotId: 'your-chatbot-id',
};

const messenger = new FlowChatMessenger(options);

async function initialize() {
  const session = await messenger.init();
  console.log('Session initialized:', session);
}

initialize();

// Example methods
messenger.typing('conversationId');
messenger.startConversation({ query: 'Hello' });
messenger.seenMessage('conversationId', { messageId: 'messageId' });
messenger.sendMessage('conversationId', { text: 'Hello' });
messenger.getMessages('conversationId').then(messages => console.log(messages));

// WebSocket events
messenger.on.connect(() => console.log('Connected'));
messenger.on.disconnect(() => console.log('Disconnected'));
messenger.on.newMessage(data => console.log('New message:', data));

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

1.0.0

5 months ago