0
Kann nicht senden Audio über Facebook senden api. Es wird immer mit einer HTTP 400 Bad Request zurückgegeben. Ich benutze Python und Urllib für die HTTP-Anfrage.Facebook senden API Senden von Audio-Ausgabe
Json:
'recipient':{
\t \t 'id' : userId
\t },
\t 'message' : {
\t \t 'attachment' : {
\t \t \t 'type' : 'audio',
\t \t \t 'payload' : {
\t \t \t \t 'url' : url
\t \t \t }
\t \t }
\t }
}
Anfrage:
def send_msg(userId,data,accessKey):
HEADERS = {
'Content-Type':'application/json'
}
url = 'https://graph.facebook.com/v2.6/me/messages?access_token='+accessKey
msg_json = {
'message' : {
'attachment' : {
'type' : 'audio',
'payload' : {
'url' : url
}
}
}
data = json.dumps(msg_json).encode('utf-8')
req = urllib.request.Request(url,data,HEADERS)
resp = urllib.request.urlopen(req)
Der Code funktioniert auf das Bild und Dateianhang, aber es funktioniert nicht auf Audio.