Trying to send location to the user from my bot? Is that allowed? If it is , what is wrong with my code I have the JSON format correct and I get the
error: { message: '(#100) Unsupported attachment type',
type: 'OAuthException',
code: 100,
error_subcode: 2018046,
fbtrace_id: 'CObB3+0fgMw' }
If anybody could provide context it would be great
function sendLocationMessage(sender,event){
let messageData={
attachment: {
"type": "location",
"payload": {
"coordinates":{
"lat": event.message.attachments[0].payload.coordinates.lat,
"long": event.message.attachments[0].payload.coordinates.long
} }
}
}
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 messages: ', error)
} else if (response.body.error) {
console.log('Error: ', response.body.error)
}
})
}