Open 53R4PH1N3 opened 5 years ago
Ah, I think you were reading the documentation for receiving attachments. To send, check out the docs for sendMessage
.
Here's an example from that section of the docs of a file upload:
const fs = require("fs");
const login = require("facebook-chat-api");
login({appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))}, (err, api) => {
if(err) return console.error(err);
// This example uploads an image called image.jpg
var yourID = "000000000000000";
var msg = {
body: "Hey!",
attachment: fs.createReadStream(__dirname + '/image.jpg')
}
api.sendMessage(msg, yourID);
});
@Schmavery yup i read that.. in this API we can use card attachments on user or only on the page?
thanks for the response ..
This api doesn't support sending card attachments, if you want to create an "official" facebook messenger bot, you probably want to use the messenger api https://developers.facebook.com/docs/messenger-platform/send-messages/template/generic
hello i'm new to this repository
when i use attachments in my object it says
{ error: 'Disallowed props: attachments' }
here's the object that put on the
api.sendMessage( ... );
var msg = { body: " ", attachments: { type: "share", url: "URL", title: "TITLE", description: "DESC" } };
and base on the Documentation on attachments under that they didn't explain how to use it...
thanks