Is it possible to send native stickers using Facebook Messenger's new API?
I tried using the following code, but the sticker is displayed as a downloaded image, rather than in native form
messageData = {
"attachment":{
"type":'image',
"payload":{
"url":stickerURL
}
}
}
} else {
messageData = {
text:content
}
}
request({
url: 'https://graph.facebook.com/v2.6/me/messages',
qs: {access_token:token},
method: 'POST',
json: {
recipient: {id:sender},
message: messageData,
}
}, function(error, response, body) {
if (error) {
console.log('Error sending message: ', error);
} else if (response.body.error) {
console.log('Error: ', response.body.error);
}
});
If you are using the facebook chat bot API from https://github.com/Schmavery/facebook-chat-api/, you can send a sticker like this:
var msg = {
body: "",
sticker: 1433995916873384
}
api.sendMessage(msg, message.threadID);
But if anyone has a way to get more sticker IDs that would be awesome! Thanks for the one above @starshine wang
EDIT: To get sticker IDs, console.log the message object you get back from api.listen. It has type sticker