Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pcostantini committed May 15, 2017
1 parent 766aa59 commit 295f4b9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Node/blog-customChannelData/node_custom_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const MSFT_APP_PW = process.env.MSFT_APP_PW;

//create an express server
var app = express();
app.listen( process.env.PORT || 3000, function(){
console.log("Express app listening on port: " + process.env.PORT || 3000);
app.listen(process.env.PORT || 3000, function () {
console.log("Express app listening on port: " + process.env.PORT || 3000);
});

//create a chat connector for the bot
Expand All @@ -27,28 +27,28 @@ var bot = new botbuilder.UniversalBot(connector);
app.post("/messages/receive", connector.listen());

//root dialog
bot.dialog("/", function(session){
bot.dialog("/", function (session) {

console.log("-------------------------------------------------");
console.log("Bot Received Message at '/' dialogue endpoint: ");

//detect Facebook Messenger message here
if(session.message.address.channelId == "facebook"){
if (session.message.address.channelId == "facebook") {
session.send("Facebook message recognized!");
session.beginDialog("/send_share_button");
session.beginDialog("/send_share_button");
} else session.send("Channel other than Facebook recognized.");

});

//where we create a facebook share button using sourceEvent
bot.dialog("/send_share_button", function(session){
bot.dialog("/send_share_button", function (session) {
//construct a new message with the current session context
var msg = new botbuilder.Message(session).sourceEvent({
//specify the channel
facebook: {
//format according to channel's requirements
//(in our case, the above JSON required by Facebook)
attachment: {
//format according to channel's requirements
//(in our case, the above JSON required by Facebook)
attachment: {
type: "template",
payload: {
template_type: "generic",
Expand Down

0 comments on commit 295f4b9

Please sign in to comment.