File Attachment

You can send files 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":"file",
      "payload":{
        "url":"https://petersapparel.com/bin/receipt.pdf"
      }
    }
  }
}' "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":"file", "payload":{}}}' \
  -F filedata=@/tmp/receipt.pdf \
  "https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"    

Fields

attachment object

Property Name Type Description

type

String

Must be file.

payload.url

String

URL of the file.

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.