Audio Attachment

You can send sounds by uploading them or sharing a URL using the Send API.

Examples

URL send

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"USER_ID"
  },
  "message":{
    "attachment":{
      "type":"audio",
      "payload":{
        "url":"https://petersapparel.com/bin/clip.mp3"
      }
    }
  }
}' "https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"    

File upload

curl  \
  -F 'recipient={"id":"USER_ID"}' \
  -F 'message={"attachment":{"type":"audio", "payload":{}}}' \
  -F 'filedata=@/tmp/clip.mp3;type=audio/mp3' \
  "https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"    

Fields

attachment object

Property Name Type Description

type

String

Must be audio.

payload.url

String

URL of audio

payload.is_reusable

Boolean

Optional. Saves the asset for later use. Set to true to save the asset and return an attachment_id.


For more information, see the Attachment Upload Reference.