Browse SDKs · WASM
Platform
SDKsWASM

Create a contact card message

Create a user contact card message with the WASM SDK.

Copy

Parameters

ParameterTypeRequiredDescription
userIDstringYesUser ID represented by the contact card.
nicknamestringYesDisplay name stored in the card.
faceURLstringYesAvatar URL stored in the card.
exstringYesComplete extension string for the card. Pass an empty string when no extension is needed.
const { data: message } = await openimsdk.createCardMessage({
  userID: 'user_b',
  nickname: 'Alex',
  faceURL: 'https://example.com/avatar.png',
  ex: '',
});

When the Promise resolves, it returns a pending MessageItem object. Note that the nickname and avatar stored in the contact card are snapshot values captured at creation time; if the user updates their profile later, the card does not update automatically. Next, deliver the card message to the target conversation using Send a message.