Attachments

An attachment is a file you upload once and then send inside a message

An attachment is a file stored in Pact.im so you can send it in a message — images, documents, audio, video, and similar media.

Upload the file first, then pass its ID in attachment_ids when you send or write a message. Until it is attached to a message, message_id may be empty. Image attachments can include a preview URL, aspect ratio, and dimensions.

Use attachments whenever the conversation needs more than plain text.

Attachment object

Example

json
{
  "attachment": {
    "id": 53439177,
    "message_id": null,
    "file_name": "1.jpg",
    "mime_type": "image/jpg",
    "size": 812089,
    "attachment_url": "The path to the file",
    "preview_url": "The path to the file",
    "aspect_ratio": 0.8,
    "data": {
      "width": 1024,
      "height": 1280
    },
    "push_to_talk": null
  }
}

Description

ParameterTypeDescription
idIntegerID
message_idIntegerID of the message
file_nameStringOriginal file name
mime_typeStringMime type (audio/ogg for example)
sizeIntegerFile size in bytes
attachment_urlStringURL of the file
preview_urlStringURL of the image preview (if it is an image)
aspect_ratioFloatAspect ratio (if it is an image)
dataObjectWidth and height (if it is an image)
push_to_talkBooleanVoice message vs regular audio file (if it is audio)

Search…

Start typing to search