let promise = window.webxdc.sendToChat(message);

sendToChat() (requires Delta Chat 1.38 or compatible) allows a webxdc app to prepare a message that can then be sent to a chat by the user. Implementations may ask the user for a destination chat and then set up the message as a draft, so it is clear that the outgoing message is a result of some user interaction.

message is an object with file, text or both set:

  • message.file: file to be sent, set name and one of blob, base64 or plainText:

    • name of the file, including extension
    • message.file.blob: JavaScript Blob, also accepts inherit types like File
    • message.file.base64: base64 encoded data
    • message.file.plainText: text for textfile, will be encoded as utf-8
  • message.text: message text to be sent

The text can usually be modified by the user and the user may decide to send the text without the file or abort sending at all. These user decisions are not reported back to the webxdc app.

To let the user focus on sending the message, calling this function may pass control back to the main app and exit the webxdc app. The promise may or may not be resolved before exit.

In case of errors, the app will not exit and the promise will be rejected.


    file: {base64: "aGVsbG8=", name: "hello.txt"},
    text: "This file was generated by GreatApp"
}).catch((error) => {


  • To send and empty file, set an empty string or blob as data. Not setting any data is an error. This is also important for messenger implementors, that need to check for eg. typeof message.file.base64 === "string" and not !message.file.base64, which would not allow empty files.

  • If you want to send text don't use btoa(), rather use message.file.plainText directly, because btoa() has problems with some unicode/emojis