Files

File message examples shown for each supported platform

All examples below must be sent within the body field of a message as shown below

{
 "receiver": {
   "contacts": [
     {
       "identifierValue": "+31612345678"
     }
   ]
 },
 "body": {...}
}

Single file message

Body

{
  "type": "file",
  "file": {
    "files": [
      {
        "contentType": "video/mp4",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
      }
    ]
  }
} 

MMS

Only SMS channels that are MMS capable support file messages. See here

WhatsApp

Google RCS

Facebook

Instagram

Line

Single file message with text

Body

{
  "type": "file",
  "file": {
    "text": "Single file message",
    "files": [
      {
        "contentType": "video/mp4",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
      }
    ]
  }
} 

MMS

Only SMS channels that are MMS capable support file messages. See here

WhatsApp

Google RCS

Facebook

Line

Multiple file message

Multiple files message

Body

{
  "type": "file",
  "file": {
    "text": "Multiple files message",
    "files": [
      {
        "contentType": "video/mp4",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
      },
      {
        "contentType": "audio/m4a",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FbgnxOoaF4aHSHUzMFCna%2Faudio.mp3?alt=media"
      }
    ]
  }
}

MMS

Only SMS channels that are MMS capable support file messages. See here

WhatsApp

Google RCS

Audio/mpeg not supported on Google RCS. Application/PDF used in this example

Facebook

Instagram

Audio/mpeg not supported on Instagram. Audio/wav used in this example

Line

Multiple files message with filename

Body

{
  "type": "file",
  "file": {
    "text": "Multiple files message",
    "files": [
      {
        "contentType": "video/mp4",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
      },
      {
        "contentType": "application/pdf",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FPnRToYX2feW96HAOrh4x%2Fdocument.pdf?alt=media",
        "filename": "passport.pdf"
      }
    ]
  }
}

WhatsApp

Google RCS

Facebook

Line

Single file message with actions

Body

{
  "type": "file",
  "file": {
    "text": "Single file message",
    "files": [
      {
        "contentType": "video/mp4",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
      }
    ],
    "actions": [
      {
        "type": "postback",
        "postback": {
          "text": "Postback action"
        }
      },
      {
        "type": "reply",
        "reply": {
          "text": "Reply action"
        }
      }
    ]
  }
}

WhatsApp

Google RCS

Facebook

Instagram

Multiple file message with actions

Miltiple files mesage with 2 postback actions and 1 reply action

Body

{
  "type": "file",
  "file": {
    "text": "Multiple files message",
    "files": [
      {
        "contentType": "video/mp4",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
      },
      {
        "contentType": "application/pdf",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FPnRToYX2feW96HAOrh4x%2Fdocument.pdf?alt=media",
        "filename": "passport.pdf"
      }
    ],
    "actions": [
      {
        "type": "postback",
        "postback": {
          "text": "Postback action 1",
          "payload": "postback-payload-1"
        }
      },
      {
        "type": "postback",
        "postback": {
          "text": "Postback action 2",
          "payload": "postback-payload-2"
        }
      },
      {
        "type": "reply",
        "reply": {
          "text": "Reply action"
        }
      }
    ]
  }
}

WhatsApp

Google RCS

Facebook

Instagram

*PDF not supported. Example using audio/wav file

Multiple files message with 4 postback actions

Body

{
  "type": "file",
  "file": {
    "files": [
      {
        "contentType": "video/mp4",
        "altText": "First file label",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media",
        "filename": "recording.mp4"
      },
      {
        "contentType": "application/pdf",
        "altText": "Second file label",
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FPnRToYX2feW96HAOrh4x%2Fdocument.pdf?alt=media",
        "filename": "passport.pdf"
      }
    ],
    "text": "Multiple files message with postback actions",
    "actions": [
      {
        "type": "postback",
        "postback": {
          "payload": "postback-payload-1",
          "text": "Postback action 1"
        }
      },
      {
        "postback": {
          "payload": "postback-payload-2",
          "text": "Postback action 2"
        },
        "type": "postback"
      },
      {
        "postback": {
          "payload": "postback-payload-3",
          "text": "Postback action 3"
        },
        "type": "postback"
      },
      {
        "postback": {
          "payload": "postback-payload-4",
          "text": "Postback action 4"
        },
        "type": "postback"
      }      
    ]
  }
}

Google RCS

Facebook

Instagram

*PDF not supported. Example using audio/wav file

Last updated