sendChatFileMessageTo(participantSessionId, fileS3Key, fileName, fileMimeType, fileSizeBytes)
Send a private file message
caution
join() must be called before calling this method
Sends a file message to a single participant only. It works exactly like sendChatFileMessage() but is private: the participantSessionId is the _id from the participantJoined event or the join() result, and the same recipient rules as sendChatMessageTo() apply.
First upload the file to POST /api/v1/chat/upload with the chat access token from getChatAccessToken(), then pass the returned fields to this method.
JavaScript
const body = new FormData();
body.append("file", file);
const res = await fetch("https://<your-app>.metered.live/api/v1/chat/upload", {
method: "POST",
headers: { Authorization: `Bearer ${meeting.getChatAccessToken()}` },
body,
});
const { fileS3Key, fileName, fileMimeType, fileSizeBytes } = await res.json();
meeting.sendChatFileMessageTo(participantSessionId, fileS3Key, fileName, fileMimeType, fileSizeBytes);
Only the sender and the recipient receive the message through the chatMessageReceived event, with recipientParticipantSessionId set and a downloadToken used to fetch the file.
See Chat file sharing for the REST upload and download endpoints.