Flexible and modular, chatbot adapter for Node.js
npm install passbot.js --save
'use strict';
const passbot = require('passbot.js');
passbot.config( {
messenger:{},
slack:{},
kik: {},
hipchat: {},
telegram:{},
skype:{},
twillio: {},
twitter: {},
});
passbot.on('message:received', function(message, reply){
console.log('You have received a message.');
var echo = {
text: message.text
};
reply(echo);
});
passbot.on('message:delivered', function(message){
console.log('Your message was delivered.', message);
});
passbot.on('message:read', function(message){
console.log('Your message was read.', message);
});
passbot.on('message:sent', function(message){
console.log('You sent a message.', message);
});
passbot.on('facebook:message:received', function(message, reply){
console.log('You have received a message on facebook.');
});
passbot.on('slack:message:received', function(message, reply){
console.log('You have received a message on slack.');
});
Attribute | Type | Description |
---|---|---|
sender | User | |
recipient | User | |
is_private | Boolean | |
is_group | Boolean | |
provider | Enum,String | |
type | Enum,String | |
id | String | |
externalId | String | |
raw | Mix Object | |
text | String |
Attribute | Type | Description |
---|---|---|
externalId | String | |
id | String | |
url | Url, String | |
displayName | String | |
is_bot | Boolean | |
emails | String[] |
Dealing with chat platforms locally can get tricky. Thankfully https://ngrok.com/ helps the process by setting up a secure tunnel to your localhost.