Media
Upload
Upload with multipart POST /v1/bot/media before attaching content. The maximum file size is 200 MB.
curl -X POST https://chat.wokey.pro/_keychat/v1/bot/media \
-H "Authorization: Bearer $KEYCHAT_BOT_TOKEN" \
-F "file=@photo.jpg"Attach
media.type is image, video, or file. Send multiple media items for a gallery; clients build the grid and reserve image dimensions while loading.
Download incoming files
For each incoming attachment, message.created includes server, media_id, and a ready-to-use download_url in message.attachments. GET /v1/bot/media/download/{server}/{mediaId} with the bot token returns verified and already decrypted bytes. Access is scoped to that bot and lasts 7 days.
curl -L "https://chat.wokey.pro/_keychat/v1/bot/media/download/$SERVER/$MEDIA_ID" \
-H "Authorization: Bearer $KEYCHAT_BOT_TOKEN" \
--output attachment.binExternal URLs
Do not substitute arbitrary remote URLs for uploads. Platform media prevents tracking, disappearing files, and mixed content.
SDK practice
Upload binary data through the SDK first, then place the returned media descriptor in attachments. Download incoming files with server and media_id from message.attachments; the SDK supplies authentication and the platform decrypts the content.
Incoming media access lasts 7 days and is limited to the bot that received it. Copy files needed for long-running processing into your own protected storage before the grant expires.
Usage examples
const bytes = await readFile('photo.png');
const media = await bot.uploadMedia(new Blob([bytes], { type: 'image/png' }), 'photo.png');
await bot.sendMessage({ chat_id: chatId, content: {
attachments: [{ type: 'image', ...media }]
}});
const attachment = event.data.message.attachments[0];
const downloaded = await bot.downloadMedia(attachment.server, attachment.media_id);