Message with Attachment

Messages of type attachments can be used to display an image with a link to download/view an attachment or website. The attachment’s extension and size can also be included.

The ext key is used to display a file type icon so users know what type of file the attachment is. Valid values are defined by the operating system.

The size key is used to display the size of the file. Set the size in bytes, for example 1 MB would be "size": 1000000.

Example

Example

Example’s JSON

{
"head": {
"text": "I am a header",
"sub_head": {
"text": "I am a sub header"
}
},
"body": [
{
"type": "attachments",
"resource_url": "https://zoom.us",
"img_url": "https://d24cgw3uvb9a9h.cloudfront.net/static/93516/image/new/ZoomLogo.png",
"information": {
"title": {
"text": "I am an attachment title"
},
"description": {
"text": "I am an attachment description"
}
}
}
]
}

Full JSON Schema

{
"type": "object",
"properties": {
"head": {
"type": "object",
"required": ["text"],
"properties": {
"text": {
"type": "string"
},
"style": {
"type": "object",
"properties": {
"color": {
"type": "string",
"format": "Hex"
},
"bold": {
"type": "boolean"
},
"italic": {
"type": "boolean"
}
}
},
"sub_head": {
"type": "object",
"required": ["text"],
"properties": {
"text": {
"type": "string"
},
"style": {
"type": "object",
"properties": {
"color": {
"type": "string",
"format": "Hex"
},
"bold": {
"type": "boolean"
},
"italic": {
"type": "boolean"
}
}
}
}
}
}
},
"body": {
"type": "array",
"items": {
"type": "object",
"required": ["type", "resource_url", "img_url", "information"],
"properties": {
"type": {
"type": "string",
"enum": ["attachments"]
},
"resource_url": {
"type": "string",
"format": "uri"
},
"img_url": {
"type": "string",
"format": "uri"
},
"information": {
"type": "object",
"required": ["title"],
"properties": {
"title": {
"type": "object",
"required": ["text"],
"properties": {
"text": {
"type": "string"
},
"style": {
"type": "object",
"properties": {
"color": {
"type": "string",
"format": "Hex"
},
"bold": {
"type": "boolean"
},
"italic": {
"type": "boolean"
}
}
}
}
},
"description": {
"type": "object",
"required": ["text"],
"properties": {
"text": {
"type": "string"
},
"style": {
"type": "object",
"properties": {
"color": {
"type": "string",
"format": "Hex"
},
"bold": {
"type": "boolean"
},
"italic": {
"type": "boolean"
}
}
}
}
}
}
},
"ext": {
"type": "string",
"enum": ["pdf", "txt", "doc", "xlsx", "zip", "jpeg", "png"]
},
"size": {
"type": "integer",
"format": "Bytes"
}
}
}
}
}
}

Need help?

If you're looking for help, try Developer Support or our Developer Forum. Priority support is also available with Premier Developer Support plans.