Created
July 1, 2019 11:04
-
-
Save stefanmm/4e78abd119f04105864c6bfafe73b0f8 to your computer and use it in GitHub Desktop.
Dialogflow + Facebook Messenger: handle stickers and images (node.js)
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
/* | |
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