-
-
Save anton-dudarev/80123ae6d3b3942f8d24a7d2b5deb152 to your computer and use it in GitHub Desktop.
Facebook Code Snippets
This file contains hidden or 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
{ | |
"facebook":{ | |
"attachment": { | |
"type": "template", | |
"payload": { | |
"template_type":"open_graph", | |
"elements":[ | |
{ | |
"url":"https://gmail.com" | |
} | |
] | |
} | |
} | |
} | |
} |
This file contains hidden or 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
{ | |
"facebook": { | |
"attachment": { | |
"type": "template", | |
"payload": { | |
"template_type":"generic", | |
"elements":[ | |
{ | |
"title":"Here is your title!", | |
"image_url":"https://i.imgur.com/fFxXB2m.png", | |
"subtitle":"Here goes your subtitle.", | |
"default_action": { | |
"type": "web_url", | |
"url": "https://google.com", | |
"webview_height_ratio": "tall" | |
}, | |
"buttons":[ | |
{ | |
"type":"web_url", | |
"url":"https://facebook.com", | |
"title":"Link to Facebook" | |
},{ | |
"type":"postback", | |
"title":"Some Text", | |
"payload":"Some Text" | |
} | |
] | |
} | |
] | |
} | |
} | |
} | |
} |
This file contains hidden or 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
const {Image} = require('dialogflow-fulfillment'); | |
// Simple text | |
const name = 'Anshul'; | |
agent.add(`Hello ${name}`); | |
// Sending images | |
agent.add(new Image('https://i.imgur.com/DYLlv4G.gif')); | |
// Sending quick replies | |
agent.add(`Would you like to understand how I may be of use to you? Please say Yes or No`); | |
agent.add(new Suggestion(`Yes`)); | |
agent.add(new Suggestion(`No`)); | |
// Sending cards | |
const card = new Card('Here is a Card Template'); | |
card.setImage('https://i.imgur.com/w6ubJcV.png'); | |
card.setText('Click on the below button '); | |
card.setButton({text: 'Go to Google.com', url: 'https://google.com'}); | |
agent.add(card); | |
// Setting contexts | |
agent.setContext({ name: 'context-name', lifespan: 2, parameters: { city: 'Rome' }}); |
This file contains hidden or 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
{ | |
"facebook": { | |
"text": "Here is a quick reply!", | |
"quick_replies":[ | |
{ | |
"content_type":"text", | |
"title":"How to get more out of your team or clients", | |
"payload":"How to get more out of your team or clients", | |
"image_url":"http://example.com/img/red.png" | |
}, | |
{ | |
"content_type":"location" | |
} | |
] | |
} | |
} |
This file contains hidden or 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
{ | |
"facebook":{ | |
"attachment": { | |
"type": "template", | |
"payload": { | |
"template_type": "media", | |
"elements": [ | |
{ | |
"media_type": "video", | |
"url": "https://www.facebook.com/AllTimeConspiracies/videos/199444947485193/" | |
} | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment