Browse SDKs · WASM
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 has created only a message object. The profile in the card is a snapshot taken at creation time and does not update automatically when the user's profile changes.