Attachments

Attachments are file type messages attached to other messages. Most message types allow one or more attachments to be added:

Message TypeAllowed Attachments
UpdatesZero or one streaming video and zero or more file attachments
Zero or more images and zero or more file attachments
CommentsZero or more attachments
Private MessagesZero or more attachments
News ItemsZero or more inline images
Zero or more non-image attachments
App UpdatesZero or more attachments
AlertsAttachments 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.

NameTypeDescription
attachmentsarrayCombined attachment container
filesarrayMiscellaneous files; wll be presented as a download.
imagesarrayImage attachments; Per image multiple thumbnails will be made available for preview purposes.
videosarrayVideo 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"
        }
    ]
}