Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

botframework

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botframework

Framework for messaging bots

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

Bot Framework

Bot Framework allows you to write bots for Facebook Messenger. But it has been designed to allow integration of other bots.

Install

npm install botframework

Usage

JavaScript

var bf = require('../');
var bot = new bf.Bot({
  fb: {
    page_id: process.env.FB_PAGE_ID, verify_id: process.env.FB_VERIFY_ID, port: process.env.FB_PORT,
    access_token: process.env.FB_ACCESS_TOKEN
  }
}, new ctrl());

function ctrl() {
  this.newUser = function (data) {
    console.log('user'+ JSON.stringify(data));
    reply.text('hi');
  };
  this.textMessage = function(data, reply) {
    reply.text('Servus: ' + data.text);
  };
  // imageMessage?(imageMessage: IImageMessage): void;
  // linkMessage?(linkMessage: ILinkMessage): void;
  // locationMessage?(locationMessage: ILocationMessage): void;
  // catchAll?(user: IBotUser, msg: Object): void;
}

TypeScript

import {IBotSettings, , IBotController} from 'botframework';
import {BotController} from './bot_controller';

let botSettings: IBotSettings = {
  fb: {
    page_id: process.env.FB_PAGE_ID, verify_token: process.env.FB_VERIFY_ID, port: process.env.FB_PORT,
    access_token: process.env.FB_ACCESS_TOKEN
  }
} ;

class BotController implements IBotController {
  textMessage(msg: ITextMessage, reply: IBotReply): any {
    reply.text('hi');
  }
}
var bot = new Bot(botSettings, new BotController());

Keywords

FAQs

Package last updated on 17 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc