Last active
February 25, 2017 17:52
-
-
Save stripethree/f20f8ea607370930ed7b3798666ae321 to your computer and use it in GitHub Desktop.
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
// Object | |
function Generic(elements) { | |
this.attachment = { | |
type: ‘template’, | |
payload: { | |
template_type: ‘generic’, | |
elements: elements | |
} | |
}; | |
} | |
// Application Usage | |
const elements = Looks.all() | |
.map((look) => { | |
return { | |
title: look.title, | |
subtitle: look.description, | |
image_url: look.imageUrl, | |
buttons: [{ | |
type: ‘postback’, | |
title: ‘Try this look’, | |
payload: `show me ${look._key}` | |
}] | |
}; | |
}); | |
messenger.send(senderId, new Generic(elements)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used in this Chatbots Magazine article.