Skip to content

Instantly share code, notes, and snippets.

@stefanmm
Created July 1, 2019 11:04
Show Gist options
  • Save stefanmm/4e78abd119f04105864c6bfafe73b0f8 to your computer and use it in GitHub Desktop.
Save stefanmm/4e78abd119f04105864c6bfafe73b0f8 to your computer and use it in GitHub Desktop.
Dialogflow + Facebook Messenger: handle stickers and images (node.js)
/*
some code...
*/
function imagesFunc(agent) {
const sticker_id = agent.request_.body.originalDetectIntentRequest.payload.data.message.sticker_id; // get "sticker_id"
if (sticker_id != undefined) { // it's a sticker
agent.add("That is nice sticker!"); // send answer to user
} else { // it is not a sticker
agent.add("Thank you for image!"); // send answer to user
}
}
/*
more code....
*/
intentMap.set('images', imagesFunc) // ("name Of Intent", functionName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment