Skip to content

Instantly share code, notes, and snippets.

@stripethree
Last active February 25, 2017 17:52
Show Gist options
  • Save stripethree/f20f8ea607370930ed7b3798666ae321 to your computer and use it in GitHub Desktop.
Save stripethree/f20f8ea607370930ed7b3798666ae321 to your computer and use it in GitHub Desktop.
// 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));
@stripethree
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment