SDKsReact Native
Create card message
Construct a user contact card message using the OpenIM React Native SDK.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
userID | string | Yes | User ID referenced on the contact card. |
nickname | string | Yes | Display nickname shown on the card. |
faceURL | string | Yes | Avatar URL shown on the card. |
ex | string | Yes | Custom 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.
Was this page helpful?