STEEM PRICE Messenger Bot - Ask for STEEM and SBD Price
Hi everyone, today I have just finished setting up a messenger bot. This bot can answer questions about Price only but I am building a separate bot with the most powerful AI that can understand not just human language but human expressions and Human feelings.
CLICK HERE TO SEE IT IN ACTION!
Why I created this bot?
I've been through a lot of discord channel and asking a bot about a certain price is the vary basic function of any channel, yet, we all use Facebook Messenger, specially here in the Philippines, not only because it's free but because it's convenient as anyone, even the person beside you right now, have a messenger account. And I never found a messenger bot that can answer questions about the price of Steemit Currencies, namely the Steem and SBD.
The Conversation Flow
The Flow of conversation is very basic. The first interaction will be trigger as soon as the user open the bot. The bot will greet you and display some options for interacting. See below:
The source code
Below are the source code of SBD and Just Replace words for steem:
// SBD
// server.js
// where your node app starts
// init project
var express = require('express');
var app = express();
var requestPromise = require('request-promise');
// we've started you off with Express,
// but feel free to use whatever libs or frameworks you'd like through `package.json`.
// http://expressjs.com/en/starter/static-files.html
app.use(express.static('public'));
// http://expressjs.com/en/starter/basic-routing.html
app.get("/", function (request, response) {
response.sendFile(__dirname + '/views/index.html');
});
app.get('/jokes', function(request, response) {
const requestOptions = {
uri: 'https://min-api.cryptocompare.com/data/price?fsym=SBD*&tsyms=PHP,USD',
headers: {
Accept: 'application/json'
},
json: true
};
requestPromise(requestOptions)
.then(function(data) {
response.json({
messages: [
{"text": "SBD IN PHP:"},
{text: data.PHP},
{"text": "SBD IN USD:"},
{text: data.USD}
]
});
});
});
// listen for requests :)
var listener = app.listen(process.env.PORT, function () {
console.log('Your app is listening on port ' + listener.address().port);
});
Comments