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

botly

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botly - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

.codeclimate.yml

9

build/aliases.js
module.exports = function (grunt, options) {
var tasks = ['jshint'];
var tasks = ["jshint", "env", "instrument", "mochaTest", "storeCoverage", "makeReport"];
return {
'tasks': ['availabletasks'],
'default': tasks
"tasks": ["availabletasks"],
"default": tasks,
"test": [
"env", "instrument", "mochaTest", "storeCoverage", "makeReport"
]
};
};

@@ -11,6 +11,6 @@ #!/usr/bin/env node

const Botly = require("botly");
const Botly = require("../index");
const botly = new Botly({
verifyToken: "this_is_a_token",
accessToken: "<YOUR_ACCESS_TOKEN>"
accessToken: process.env.ACCESS_TOKEN
});

@@ -26,3 +26,3 @@

if (users[sender]) {
if (data && data.text.indexOf("image") !== -1) {
if (data && data.text && data.text.indexOf("image") !== -1) {
botly.sendImage(sender, "https://upload.wikimedia.org/wikipedia/en/9/93/Tanooki_Mario.jpg", function (err, whatever) {

@@ -32,3 +32,3 @@ console.log(err);

}
else if (data && data.text.indexOf("buttons") !== -1) {
else if (data && data.text &&data.text.indexOf("buttons") !== -1) {
let buttons = [];

@@ -41,3 +41,3 @@ buttons.push(botly.createWebURLButton("Go to Askrround", "http://askrround.com"));

}
else if (data && data.text.indexOf("generic") !== -1) {
else if (data && data.text && data.text.indexOf("generic") !== -1) {
let buttons = [];

@@ -54,3 +54,3 @@ buttons.push(botly.createWebURLButton("Go to Askrround", "http://askrround.com"));

}
else if (data && data.text.indexOf("receipt") !== -1) {
else if (data && data.text && data.text.indexOf("receipt") !== -1) {
let payload = {

@@ -57,0 +57,0 @@ "recipient_name": "Stephane Crozatier",

@@ -53,3 +53,3 @@ "use strict";

router.get(this.webHookPath, ((req, res) => {
router.get(this.webHookPath, (req, res) => {
if (req.query["hub.verify_token"] === this.verifyToken) {

@@ -60,5 +60,5 @@ res.send(req.query["hub.challenge"]);

}
}).bind(this));
});
router.post(this.webHookPath, ((req, res) => {
router.post(this.webHookPath, (req, res) => {
res.sendStatus(200); //return 200 to facebook no matter what

@@ -70,3 +70,3 @@ try {

}
}).bind(this));
});

@@ -76,3 +76,3 @@ return router;

Botly.prototype.getUserProfile = function (userId, cb) {
Botly.prototype.getUserProfile = function (userId, callback) {
const USER_URL = `${FB_URL}${userId}`;

@@ -90,4 +90,4 @@

}, (err, res, body) => {
if (cb) {
cb(err, body);
if (callback) {
callback(err, body);
}

@@ -124,3 +124,8 @@ });

Botly.prototype.send = function (recipientId, message, callback) {
Botly.prototype.send = function (recipientId, message, notificationType, callback) {
notificationType = notificationType || this.notificationType;
if (typeof notificationType === "function") {
callback = notificationType;
notificationType = this.notificationType;
}
request.post(

@@ -136,3 +141,3 @@ {

message: message,
notification_type: this.notificationType
notification_type: notificationType
}

@@ -147,3 +152,3 @@

Botly.prototype.sendAttachment = function (recipientId, type, payload, callback) {
Botly.prototype.sendAttachment = function (recipientId, type, payload, notificationType, callback) {
this.send(recipientId, {

@@ -154,30 +159,30 @@ attachment: {

}
}, callback);
}, notificationType, callback);
};
Botly.prototype.sendImage = function (recipientId, imageURL, callback) {
Botly.prototype.sendImage = function (recipientId, imageURL, notificationType, callback) {
this.sendAttachment(recipientId, ATTACHMENT_TYPE.IMAGE, {
url: imageURL
}, callback);
}, notificationType, callback);
};
Botly.prototype.sendText = function (recipientId, text, callback) {
Botly.prototype.sendText = function (recipientId, text, notificationType, callback) {
this.send(recipientId, {
text: text
}, callback);
}, notificationType, callback);
};
Botly.prototype.sendButtons = function (recipientId, text, buttons, callback) {
Botly.prototype.sendButtons = function (recipientId, text, buttons, notificationType, callback) {
this.sendAttachment(recipientId, ATTACHMENT_TYPE.TEMPLATE,
this.createButtonTemplate(text, buttons), callback);
this.createButtonTemplate(text, buttons), notificationType, callback);
};
Botly.prototype.sendGeneric = function (recipientId, elements, callback) {
Botly.prototype.sendGeneric = function (recipientId, elements, notificationType, callback) {
this.sendAttachment(recipientId, ATTACHMENT_TYPE.TEMPLATE,
this.createGenericTemplate(elements), callback);
this.createGenericTemplate(elements), notificationType, callback);
};
Botly.prototype.sendReceipt = function (recipientId, payload, callback) {
Botly.prototype.sendReceipt = function (recipientId, payload, notificationType, callback) {
payload.template_type = TEMPLATE_TYPE.RECEIPT;
this.sendAttachment(recipientId, ATTACHMENT_TYPE.TEMPLATE, payload, callback);
this.sendAttachment(recipientId, ATTACHMENT_TYPE.TEMPLATE, payload, notificationType, callback);
};

@@ -184,0 +189,0 @@

{
"name": "botly",
"version": "0.1.3",
"version": "0.2.0",
"description": "Simple Facebook Messenger Bot API",

@@ -15,2 +15,3 @@ "main": "index.js",

"fb",
"botly",
"facebook",

@@ -38,8 +39,16 @@ "messenger",

"devDependencies": {
"chai": "^3.5.0",
"grunt": "^1.0.1",
"grunt-available-tasks": "^0.6.2",
"grunt-contrib-jshint": "^1.0.0",
"grunt-env": "^0.4.4",
"grunt-istanbul": "^0.7.0",
"grunt-mocha-test": "^0.12.7",
"load-grunt-config": "^0.19.2",
"mocha": "^2.4.5",
"mockery": "^1.7.0",
"node-mocks-http": "^1.5.2",
"sinon": "^1.17.4",
"time-grunt": "^1.3.0"
}
}
botly
---------
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)
[![Build Status](https://travis-ci.com/Askrround/botly.svg?token=d9DyBzKtc6v8W4BUJ1pp&branch=master)](https://travis-ci.com/Askrround/botly)
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](http://gruntjs.com/)
[![Build Status](https://travis-ci.org/Askrround/botly.svg)](https://travis-ci.org/Askrround/botly)
[![Test Coverage](https://codeclimate.com/github/Askrround/botly/badges/coverage.svg)](https://codeclimate.com/github/Askrround/botly/coverage)
[![npm version](https://badge.fury.io/js/botly.svg)](http://badge.fury.io/js/botly)

@@ -9,2 +10,3 @@ [![Dependency Status](https://david-dm.org/Askrround/botly.svg?theme=shields.io)](https://david-dm.org/Askrround/botly)

[![npm downloads](https://img.shields.io/npm/dm/botly.svg)](https://img.shields.io/npm/dm/botly.svg)
[![license](https://img.shields.io/npm/l/botly.svg)](LICENSE)
[![NPM](https://nodei.co/npm/botly.png)](https://nodei.co/npm/botly/)

@@ -17,9 +19,9 @@

- [API](#api)
- [send (recipientId, message[, callback])](#send-recipientid-message-callback)
- [sendText (recipientId, text[, callback])](#sendtext-recipientid-text-callback)
- [sendAttachment (recipientId, type, payload[, callback])](#sendattachment-recipientid-type-payload-callback)
- [sendImage (recipientId, imageURL[, callback])](#sendimage-recipientid-imageurl-callback)
- [sendButtons (recipientId, text, buttons[, callback])](#sendbuttons-recipientid-text-buttons-callback)
- [sendGeneric (recipientId, elements[, callback])](#sendgeneric-recipientid-elements-callback)
- [sendReceipt (recipientId, payload[, callback])](#sendreceipt-recipientid-payload-callback)
- [send (recipientId, message[, notificationType][, callback])](#send-recipientid-message-notificationtype-callback)
- [sendText (recipientId, text[, notificationType][, callback])](#sendtext-recipientid-text-notificationtype-callback)
- [sendAttachment (recipientId, type, payload[, notificationType][, callback])](#sendattachment-recipientid-type-payload-notificationtype-callback)
- [sendImage (recipientId, imageURL[, notificationType][, callback])](#sendimage-recipientid-imageurl-notificationtype-callback)
- [sendButtons (recipientId, text, buttons[, notificationType][, callback])](#sendbuttons-recipientid-text-buttons-notificationtype-callback)
- [sendGeneric (recipientId, elements[, notificationType][, callback])](#sendgeneric-recipientid-elements-notificationtype-callback)
- [sendReceipt (recipientId, payload[, notificationType][, callback])](#sendreceipt-recipientid-payload-notificationtype-callback)
- [setWelcomeScreen (pageId, message[, callback])](#setwelcomescreen-pageid-message-callback)

@@ -64,3 +66,3 @@ - [getUserProfile (userId[, callback])](#getuserprofile-userid-callback)

#### send (recipientId, message[, callback])
#### send (recipientId, message[, notificationType][, callback])
```javascript

@@ -74,3 +76,3 @@ botly.send(userId, {

#### sendText (recipientId, text[, callback])
#### sendText (recipientId, text[, notificationType][, callback])
```javascript

@@ -82,3 +84,3 @@ botly.sendText(userId, "Hi There!", function (err, data) {

#### sendAttachment (recipientId, type, payload[, callback])
#### sendAttachment (recipientId, type, payload[, notificationType][, callback])
```javascript

@@ -93,3 +95,3 @@ botly.sendAttachment(userId, Botly.CONST.ATTACHMENT_TYPE.IMAGE,

#### sendImage (recipientId, imageURL[, callback])
#### sendImage (recipientId, imageURL[, notificationType][, callback])
```javascript

@@ -101,3 +103,3 @@ botly.sendImage(userId, "http://example.com/image.png", function (err, data) {

#### sendButtons (recipientId, text, buttons[, callback])
#### sendButtons (recipientId, text, buttons[, notificationType][, callback])
```javascript

@@ -113,3 +115,3 @@ let buttons = [];

#### sendGeneric (recipientId, elements[, callback])
#### sendGeneric (recipientId, elements[, notificationType][, callback])
```javascript

@@ -128,3 +130,3 @@ let buttons = [];

#### sendReceipt (recipientId, payload[, callback])
#### sendReceipt (recipientId, payload[, notificationType][, callback])
```javascript

@@ -131,0 +133,0 @@ let payload = {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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