Skip to content

2012mjm/soroush-bot-node-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Soroush Messenger Bot Node SDK

Soroush Messenger Bot Wrapper for Node developer

Dependencies

  • request
  • eventsource
  • image-size
  • is-image

Installation

Run the below commands

yarn add soroush-bot-node-sdk

Usage

const SoroushBot = require("SoroushBot");

const bot = new SoroushBot(bot_token);

bot.onMessage = message => {
  console.log(
    `New message from ${message.from} \nType: ${message.type}\nBody: ${message.body}`
  );

  bot.sendText(message.from, "Your message receive").then(
    res => {
      console.log(res);
    },
    err => {
      console.log(err);
    }
  );
};

"to" value in above example is chat_id of a bot user. You can find it in front of 'from' key in a message that user has sent to your bot. You can see more examples in the examples directory.

Run the below commands

git clone https://github.com/2012mjm/soroush-bot-node-sdk
cd soroush-bot-node-sdk
yarn
cd examples
node echo_bot.js

Contribute

Contributions to the package are always welcome!

About

Soroush Messenger Bot Wrapper for Node

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published