Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Cannot add attachments to convo.say #196

Closed
jayprat95 opened this issue Apr 19, 2016 · 7 comments
Closed

Cannot add attachments to convo.say #196

jayprat95 opened this issue Apr 19, 2016 · 7 comments

Comments

@jayprat95
Copy link

Hi,

I cannot add attachments inside of conversation replies. This means that you cannot reply in a conversation with a structured message for facebook bots and can't send images or such as replies.

Also, thanks for building an awesome framework! It's so easy to use

@eshaham
Copy link

eshaham commented Apr 21, 2016

👍 cannot figure out how to include attachments and follow up with facebook_postback if in the middle of a conversation.

@blanxii
Copy link

blanxii commented Apr 25, 2016

If you mean send facebook cards the answer is, yes you can.

Just add a json structure (or some function to make it).

And you can use callbacks with json response.

bot.reply(message, { attachment: { type: "template", payload: { template_type: "button", text: "Did you llike it?", buttons: [{ type: "postback", title: "yes", payload: JSON.stringify({ action, value, params }); }, { type: "postback", title: "No", payload: JSON.stringify({ action, value, params }); }], } } });

@eshaham
Copy link

eshaham commented Apr 25, 2016

@blanxii but how do you use it as part of a conversation? convo.ask
doesn't seem to support attachments.
On Apr 25, 2016 19:38, "blanxii" [email protected] wrote:

If you mean send facebook cards the answer is, yes you can.

Just add a json structure (or some function to make it).

And you can use callbacks with json response.

bot.reply(message, {
attachment: {
type: "template",
payload: {
template_type: "button",
text: "Did you llike it?",
buttons: [{
type: "postback",
title: "yes",
payload: JSON.stringify({
action,
value,
params
});
}, {
type: "postback",
title: "No",
payload: JSON.stringify({
action,
value,
params
});
}],
}
}
});


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#196 (comment)

@blanxii
Copy link

blanxii commented Apr 25, 2016

@eshaham Sorry didn't read about conversation system. This system didn't support the conversation with cards. You should make something like routing all requests (if you see botkid they make this system for conversation, they add in conversation message something like:

<controller_name>#<message>

Controller_name route the current message in those conversation. And you should make something like that.

Send Facebook card with payload:

  buttons: [{
       type: "postback",
       title: "Free",
       payload: JSON.stringify({action, value, params });
}

When user trigger option you should route it

controller.on('facebook_postback', (bot, message) => {
    const payload = JSON.parse(message.payload);
    botPostback[payload.action](bot, message, payload);
});

With that you can make a "fake conversation system"...

@crummy
Copy link

crummy commented May 10, 2016

I'd like to be able to embed images in conversation.say(), too. Been poking around other methods but haven't been able to get it to work without bot.reply.

@crummy
Copy link

crummy commented May 10, 2016

Looks like someone's already implemented this and opened a pull request for it. Works great for me with embedded images.
#208

@benbrown
Copy link
Contributor

This has been fixed via PRs! Thanks guys. You should now be able to include the attachment field everywhere.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants