Last active
July 13, 2018 08:25
-
-
Save ouadie-lahdioui/ecd6101ede73ed31c14dfaab73ceadb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Buttons | |
Builder.CardAction.imBack(session, "1", "Trouver un emploi") | |
new builder.CardAction(session).title('Add a number').value('Add').type('imBack') | |
Builder.CardAction.dialogAction(session, "weather", "Seattle, WA", "Current Weather") | |
Builder.CardAction.postBack(...) | |
// Send Attachement | |
var msg = session.message; | |
var attachment = msg.attachments[0]; | |
session.send({ | |
text: "You sent:", | |
attachments: [{ | |
contentType: attachment.contentType, | |
contentUrl: attachment.contentUrl, | |
name: attachment.name | |
}] | |
}); | |
//detect Facebook Messenger message here | |
if (session.message.address.channelId === "facebook") | |
//create a facebook share button using sourceEvent | |
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: { | |
type: "template", | |
payload: { | |
template_type: "generic", | |
elements: [ | |
{ | |
title: "Microsoft Bot Framework", | |
subtitle: "Check it out!", | |
buttons: [ | |
{ | |
type: "web_url", | |
url: "https://dev.botframework.com", | |
title: "Go to Dev Portal" | |
}, | |
{ | |
//this is our share button | |
type: "element_share" | |
} | |
] | |
} | |
] | |
} | |
} //end of attachment | |
} | |
}); | |
// Prompts | |
var choices = [{ value: 'en', title: "English" },{ value: 'es', title: "Español" }]; | |
builder.Prompts.choice(session, "Please select your preferred language.", choices); | |
builder.Prompts.choice(session, "What's your preferred language?", 'English|Español|Italiano'); | |
// Session | |
session.error(err); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment