SDKsuni-app
Send an uploaded media message
OpenIM uni-app / uni-app x SDK guide for Send an uploaded media message.
Use sendMessageNotOss() when an image, audio, video, or file was already uploaded by your business service and the message contains its URL. This avoids the SDK upload phase.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
recvID | string | Conditional | Receiver user ID for a single chat; otherwise pass an empty string. |
groupID | string | Conditional | Group ID for a group chat; otherwise pass an empty string. |
message | OpenIMMessageItem | Yes | Outgoing message returned by a by-URL create API with complete remote resource metadata. |
offlinePushInfo | OpenIMOfflinePush or null | No | Offline-push title, description, and platform settings. |
isOnlineOnly | boolean or null | No | Deliver only to online clients; such a message is not stored in local history. |
import { sendMessageNotOss } from '@/uni_modules/unix-openim-sdk'
const sentMessage = await sendMessageNotOss({
recvID: receiverUserID,
groupID: '',
message: urlMessage,
})The URL, size, type, dimensions, and duration must come from the real upload result. The Promise resolves directly to the server-confirmed OpenIMMessageItem; merge it by clientMsgID.
This method does not upload resources and must not receive a message that only contains a local file path, or recipients may be unable to access it. Send local-file messages with sendMessage().
Was this page helpful?