Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Publish or update group announcement

Publish, modify, or clear group announcement notices.

Copy

The notification field contains the public group announcement, separate from the group's introduction description. Permissions are verified on the server; display editing controls according to the user's role level:

Code example

import sdk, { SetGroupInfoReq } from '@openimsdk/imsdk';

const request: SetGroupInfoReq = {
  groupID: groupID,
  notification: announcement.trim(),
};
await sdk.setGroupInfo(request);

Parameters

ParameterTypeRequiredDescription
groupIDstringYesTarget group identifier.
notificationstringYesAnnouncement text. Pass an empty string to clear the announcement.

Return value

Returns a Promise that resolves to void upon updating the announcement.

State changes after the call

Resolving the Promise confirms that the announcement was saved on the server. The SDK emits EventOnGroupInfoChanged; match the group by groupID and update its notification property in the UI, as detailed in Group overview.