Created
October 6, 2021 08:00
-
-
Save warodri-sendbird/7ed1bc74c3e2ff5724ea8698b998bda4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sending a file message with a raw file | |
const params = new sb.FileMessageParams(); | |
params.file = FILE; // Or .fileUrl = FILE_URL (You can also send a file message with a file URL.) | |
params.fileName = FILE_NAME; | |
params.fileSize = FILE_SIZE; | |
params.thumbnailSizes = [{maxWidth: 100, maxHeight: 100}, {maxWidth: 200, maxHeight: 200}]; // Add the maximum sizes of thumbnail images (allowed number of thumbnail images: 3). | |
params.mimeType = MIME_TYPE; | |
params.customType = CUSTOM_TYPE; | |
params.mentionType = 'users'; // Either 'users' or 'channel' | |
params.mentionedUserIds = ['Jeff', 'Julia']; // Or mentionedUsers = Array<User>; | |
params.pushNotificationDeliveryOption = 'default'; // Either 'default' or 'suppress' | |
groupChannel.sendFileMessage(params, function(fileMessage, error) { | |
if (error) { | |
// Handle error. | |
} | |
// A file message with detailed configuration is successfully sent to the channel. | |
// By using fileMessage.messageId, fileMessage.fileName, fileMessage.customType, and so on, | |
// you can access the result object from the Sendbird server to check your FileMessageParams configuration. | |
// The current user can receive messages from other users through the onMessageReceived() method of an event handler. | |
const messageId = fileMessage.messageId; | |
... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment