Attachments
Attachments are file type messages attached to other messages. Most message types allow one or more attachments to be added:
Message Type | Allowed Attachments |
---|---|
Updates | Zero or one streaming video and zero or more file attachments Zero or more images and zero or more file attachments |
Comments | Zero or more attachments |
Private Messages | Zero or more attachments |
News Items | Zero or more inline images Zero or more non-image attachments |
App Updates | Zero or more attachments |
Alerts | Attachments not supported |
The message resource has several properties for posting attachments. The most common one, and pre-1.4 the only one, is the attachments
property. This array accepts files of different types of which all images will be previewable through thumbnails.
From API version 1.4 onwards the bottom three properties were introduced for update
type messages. This is a more explicit way of attaching files and gives over control of for what files previews are (made) available.
Name | Type | Description |
---|---|---|
attachments | array | Combined attachment container |
files | array | Miscellaneous files; wll be presented as a download. |
images | array | Image attachments; Per image multiple thumbnails will be made available for preview purposes. |
videos | array | Video attachments; will automatically be transcoded into several renditions made available for streaming playback. |
Examples
Attach playable video
{
"messageType": "update",
"body": "It's video Jim, but not as we know it.",
"recipient": {
"EID": "ABCDEF9876543210",
"type": "user"
},
"videos": [
{
"EID": "1234567890ABCDEF",
"type": "message"
}
]
}
Attach images and files
{
"messageType": "update",
"body": "I immediately regret this decision!",
"recipient": {
"EID": "1234567890ABCDEF",
"type": "network"
},
"images": [
{
"EID": "1ABCDEF234567890",
"type": "message"
},
{
"EID": "21ABCDEF34567890",
"type": "message"
},
{
"EID": "321ABCDEF4567890",
"type": "message"
}
],
"files": [
{
"EID": "9876543210ABCDEF",
"type": "message"
},
{
"EID": "FEDCBA9876543210",
"type": "message"
}
]
}
Attach file to private message
{
"messageType": "private_message",
"body": "Here I am at the Alamo in San Antonio. This was just outside of the gift shop. Do you see?!",
"recipient": {
"EID": "ABCDEF9876543210",
"type": "conversation"
},
"attachments": [
{
"EID": "1234567890ABCDEF",
"type": "message"
}
]
}
Create news item with inline images
{
"messageType": "news",
"htmlBody": "
<p><img src=\"https://speakap.speakap.com/files/1ABCDEF234567890/\"
data-eid=\"1ABCDEF234567890\"
data-rel=\"attachment\" />
</p>
<p><a src=\"https://speakap.speakap.com/files/21ABCDEF34567890/\"
data-eid=\"21ABCDEF34567890\"
data-rel=\"attachment\" />
</p>",
"recipient": {
"EID": "1234567890ABCDEF",
"type": "network"
},
"attachments": [
{
"EID": "1ABCDEF234567890",
"type": "message"
},
{
"EID": "21ABCDEF34567890",
"type": "message"
}
]
}