1.0.4 • Published 7 years ago
botfolio-chatbot v1.0.4
botfolio-chatbot
Build your botfolio chatbot. Signup https://developers.botfol.io, create a chatbot on the dashboard, get your chatbot api token and start to build your own chatbot for botfol.io.
What is botfolio?
Botfolio is a web service for building and deploying conversational chatbots. It is an integrated development environment for building chatbots included with lots of features and tools. You can also, integrate your bot into your iOS and Android applications using our mobile SDKs. For further information visit http://botfol.io
Send Text Message
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.sendTextMessage({
disable_notification : false, required_input_type: "text",
user_id: 1, text: "Hi!",
quick_replies : [{ payload: "USER_DEFINED_PAYLOAD", title : "Find a product" }, { title : "Rate a product", payload : "USER_DEFINED_PAYLOAD" }]
}).then(function (messageResponse) { });
Send Image Message
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.sendImageMessage({
disable_notification : false, required_input_type: "text",
user_id: 1, url: "https://example.com/example.png", content_type : "image/png",
quick_replies : [{ payload: "USER_DEFINED_PAYLOAD", title : "Find a product" }, { title : "Rate a product", payload : "USER_DEFINED_PAYLOAD" }]
}).then(function (messageResponse) { });
Send Video Message
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.sendVideoMessage({
disable_notification : false, required_input_type: "text", user_id: 1,
url: "https://example.com/example.mp4", content_type : "video/mp4",
quick_replies : [{ payload: "USER_DEFINED_PAYLOAD", title : "Find a product" }, { title : "Rate a product", payload : "USER_DEFINED_PAYLOAD" }]
}).then(function (messageResponse) { });
Send Voice Message
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.sendVoiceMessage({
disable_notification : false, required_input_type: "text", user_id: 1,
url: "https://example.com/example.wav", content_type : "audio/wav",
quick_replies : [{ payload: "USER_DEFINED_PAYLOAD", title : "Find a product" }, { title : "Rate a product", payload : "USER_DEFINED_PAYLOAD" }]
}).then(function (messageResponse) { });
Send Location Message
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.sendLocationMessage({
disable_notification : false, required_input_type: "text", latitude : 37.773972, longitude : -122.431297,
title : "Facebook HQ", address : "1 Hacker WayMenlo Park, California", user_id: 12552,
quick_replies : [{ payload: "USER_DEFINED_PAYLOAD", title : "Find a product" }, { title : "Rate a product", payload : "USER_DEFINED_PAYLOAD" }]
}).then(function (messageResponse) { });
Send Contact Message
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.sendContactMessage({
disable_notification : false, required_input_type: "text",
first_name: "Burhan", last_name: "Cetinkaya", phone_number: "+14158005959",
user_id: 1, url: "https://example.com/example.png", content_type : "image/png",
quick_replies : [{ payload: "USER_DEFINED_PAYLOAD", title : "Find a product" }, { title : "Rate a product", payload : "USER_DEFINED_PAYLOAD" }]
}).then(function (messageResponse) { });
Send Document Message
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.sendImageMessage({
disable_notification : false, required_input_type: "text",
user_id: 1, url: "https://example.com/example.pdf", content_type : "application/pdf",
quick_replies : [{ payload: "USER_DEFINED_PAYLOAD", title : "Find a product" }, { title : "Rate a product", payload : "USER_DEFINED_PAYLOAD" }]
}).then(function (messageResponse) { });
Send Buttons Template Message
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.sendButtonsTemplateMessage({
disable_notification : false, required_input_type: "text",
user_id: 1,
text : "How may i help you?" ,
buttons :
[
{ payload : "USER_DEFINED_PAYLOAD", title: "Find a product", type : "payload" },
{ payload : "+14158005959", title : "Call me", type : "phone_number" },
{ title : "Visit page", type : "web_url", url : "https://example.com" }
],
quick_replies : [{ payload: "USER_DEFINED_PAYLOAD", title : "Find a product" }, { title : "Rate a product", payload : "USER_DEFINED_PAYLOAD" }]
}).then(function (messageResponse) { });
Send Generic Template Message
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.sendGenericTemplateMessage({
disable_notification : false, required_input_type: "text",
user_id: 1,
elements : [
{
image_url : "https://example.com/example.png",
sub_title : "Description 1", title : "Title 1" ,
buttons : [{ payload : "USER_DEFINED_PAYLOAD", title : "Find a product", type : "payload" },
{ payload : "+14158005959", title : "Call me", type : "phone_number" },
{ title : "Visit page", type : "web_url", url: "https://example.com" }]
},
{
image_url : "https://example.com/example2.png",
sub_title : "Description 2", title : "Title 2" ,
buttons : [{ payload : "USER_DEFINED_PAYLOAD", title : "Find a product", type : "payload" },
{ payload : "+14158005959", title : "Call me", type : "phone_number" },
{ title : "Visit page", type : "web_url", url: "https://example.com" }]
}
],
quick_replies : [{ payload: "USER_DEFINED_PAYLOAD", title : "Find a product" }, { title : "Rate a product", payload : "USER_DEFINED_PAYLOAD" }]
}).then(function (messageResponse) { });
Set Typing Status
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.setTypingStatus({user_id:1, timeout:1000}).then(function (messageResponse) { });
Get User Information
require('promise');
var botfolioChatBot = require("botfolio-chatbot");
var service = new botfolioChatBot("YOUR_CHATBOT_API_TOKEN");
service.getUserInformation(1).then(function (userResponse) { });