ChitChat Bot
A Node.js wrapper for ChitChat Bot API
This package allows user to create Node Chat Bots for the Chatting Web Application ChitChat.
Getting Started
Prerequisites
You need a username and Client Secret for your Bot before building Bots for the Application. In order to get those credentials, just Register on the Website ChitChat, and click Create a new Bot to get the Client Secret for your new Bot.
Installation
Install using NPM:
npm install chitchat-bot
Or, directly using Git:
cd ./node_modules
git clone https://github.com/anuj-aggarwal/chitchat-bot.git
Setup
// Require the Libraryconst ChitChatBot = ; // Create a new Bot// username: username of Bot supplied while creting bot// clientSecret: Client Secret for Bot given on creation of Botconst myBot = username clientSecret;
Usage
Private Chats:
const ChitChatBot = ;const myBot = username clientSecret; // Sets up Event Listener to listen for New ChatsmyBot; // Sets up Event Listener to listen for New User MessagesmyBot; // Sets up Event Listener to listen for Unread Messages Event called with messages sent while Bot was inactivemyBot; // Send a message to a private ChatmyBot;
Channels:
const ChitChatBot = ;const myBot = username clientSecret; // Join a ChannelmyBot; // Sets up Event Listener for Channel Members sent whenever the members changemyBot; // Sets up Event Listener for Channel Alerts sentmyBot; // Sets up Event Listener to listen for New Channel MessagesmyBot; // Send a message to a ChannelmyBot;// forList: list of usernames to show this message to([] if meant for all)
Built With
- Socket.io-Client - Used for Managing Web Sockets