Browse SDKs · React Native
Platform
SDKsReact Native

Create card message

Construct a user contact card message using the OpenIM React Native SDK.

Copy

Construct a contact card message representing a user profile:

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

Parameters

ParameterTypeRequiredDescription
userIDstringYesUser ID referenced on the contact card.
nicknamestringYesDisplay nickname shown on the card.
faceURLstringYesAvatar URL shown on the card.
exstringYesCustom extension string; pass empty string "" if not provided.

Return value

A resolved Promise returns the initialized MessageItem object with contact details populated in cardElem.

This method prepares the message locally in memory; it does not transmit network packets or trigger message delivery events. After creating the message object, invoke Send message to send it to a one-to-one or group conversation.