Upload Files

Send messages with file attachments and track upload progress in real-time using ALO's JavaScript SDK.

Send messages with files attached to them and update your app to reflect the progress as the file uploads.

chat.addEventListener(function(event) {
    switch(event.type) {
        case "file.upload.progress": {
            /*
                event = {
                    type: "file.upload.progress",
                    data: {
                        file,
                        percent: 50 // (0 - 100)
                    }
                }
            */
            break;
        }
        case "file.upload.complete": {
            /*
                event = {
                    type: "file.upload.complete",
                    data: { file }
                }
            */
            break;
        }
        case "file.upload.error": {
            /*
                event = {
                    type: "file.upload.error",
                    data: { file }
                }
            */
            break;
        }
        default:
    }
});

chat.sendMessage({
    channelId: "alpha",
    content: "<p>Here is a picture of my cat!</p>",
    files: [File]
})

Last updated

Logo

© Copyright 2024 ALO.ai, Inc. • All Rights Reserved