Browse SDKs · uni-app / uni-app x
SDKsuni-app

Create a contact card message

OpenIM uni-app / uni-app x SDK guide for Create a contact card message.

Copy

Parameters

createCardMessage() accepts OpenIMCardElem. Its fields are nullable in the contract, but a useful card should provide a complete snapshot:

ParameterTypeRecommendationDescription
userIDstring or nullRequiredUser represented by the card.
nicknamestring or nullRequiredDisplay name snapshot.
faceURLstring or nullRequiredAvatar URL snapshot.
exstring or nullRequiredExtension data; use an empty string when unused.
import { createCardMessage } from '@/uni_modules/unix-openim-sdk'

const message = await createCardMessage({
  userID: 'user_b',
  nickname: 'Alex',
  faceURL: 'https://example.com/avatar.png',
  ex: '',
})

The Promise creates OpenIMMessageItem | null and does not send it. A card is a send-time snapshot and does not track profile changes. Resolve current data by userID when opened, and never treat card fields as authenticated identity.