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

bottender-chatbase

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bottender-chatbase - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

11

CHANGELOG.md

@@ -1,7 +0,12 @@

# 0.2.0 / 2017-12-07
0.2.1 / 2017-12-08
==================
* [fix] Fix koa return next
* [fix] Fix crash on some event types
0.2.0 / 2017-12-07
==================
* [new] Support koa middleware
# 0.1.0 / 2017-12-05
0.1.0 / 2017-12-05
==================
* [new] Support express middleware

@@ -25,5 +25,25 @@ 'use strict';

req.body.entry.forEach(entry => {
const { sender: { id }, message: { text } } = entry.messaging[0];
let messaging;
if (entry.messaging) {
messaging = entry.messaging[0];
} else if (entry.standby) {
messaging = entry.standby[0];
} else {
return;
}
chatbase.newMessage().setAsTypeUser().setUserId(id).setTimestamp(Date.now().toString()).setMessage(text).send().catch(console.error);
const { id } = messaging.sender;
let logMessage;
if (messaging.message && messaging.message.text) {
logMessage = `Text: ${messaging.message.text}`;
} else if (messaging.message && messaging.message.quick_reply) {
logMessage = `Quick Reply Payload: ${messaging.message.quick_reply.payload}`;
} else if (messaging.postback) {
logMessage = `Postback Payload: ${messaging.postback.payload}`;
} else {
return;
}
chatbase.newMessage().setAsTypeUser().setUserId(id).setTimestamp(Date.now().toString()).setMessage(logMessage).send().catch(console.error);
});

@@ -30,0 +50,0 @@

@@ -25,9 +25,29 @@ 'use strict';

request.body.entry.forEach(entry => {
const { sender: { id }, message: { text } } = entry.messaging[0];
let messaging;
if (entry.messaging) {
messaging = entry.messaging[0];
} else if (entry.standby) {
messaging = entry.standby[0];
} else {
return;
}
chatbase.newMessage().setAsTypeUser().setUserId(id).setTimestamp(Date.now().toString()).setMessage(text).send().catch(console.error);
const { id } = messaging.sender;
let logMessage;
if (messaging.message && messaging.message.text) {
logMessage = `Text: ${messaging.message.text}`;
} else if (messaging.message && messaging.message.quick_reply) {
logMessage = `Quick Reply Payload: ${messaging.message.quick_reply.payload}`;
} else if (messaging.postback) {
logMessage = `Postback Payload: ${messaging.postback.payload}`;
} else {
return;
}
chatbase.newMessage().setAsTypeUser().setUserId(id).setTimestamp(Date.now().toString()).setMessage(logMessage).send().catch(console.error);
});
next();
return next();
};
}

@@ -15,5 +15,14 @@ "use strict";

if (/graph\.facebook\.com.*\/me\/messages/.test(config.url)) {
const { recipient: { id }, message: { text } } = JSON.parse(config.data);
const messaging = JSON.parse(config.data);
const { id } = messaging.recipient;
let logMessage;
chatbase.newMessage().setAsTypeAgent().setUserId(id).setTimestamp(Date.now().toString()).setMessage(text).send().catch(e => console.error(e));
// TODO: handle more message type?
if (messaging.message && messaging.message.text) {
logMessage = `Text: ${messaging.message.text}`;
} else {
return response;
}
chatbase.newMessage().setAsTypeAgent().setUserId(id).setTimestamp(Date.now().toString()).setMessage(logMessage).send().catch(e => console.error(e));
}

@@ -20,0 +29,0 @@

@@ -9,3 +9,3 @@ {

},
"version": "0.2.0",
"version": "0.2.1",
"main": "lib/index.js",

@@ -12,0 +12,0 @@ "files": [

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