Modifying Group Member Profiles

Last updated: 2020-03-11 15:38:30

PDF

Feature Description

The app admin can modify group members’ profiles through this API.

API Invocation Description

Applicable group types

Group Type Support This RESTful API
Private Yes
Public Yes
ChatRoom Yes
AVChatRoom Support modifying the profiles of the admin and group owner
BChatRoom No

IM supports the preceding five types of groups. For details, see Group Systems.

For AVChatRoom groups, only the profiles of the admin and group owner can be modified due to internal implementation reasons. If you try to modify an ordinary member’s profile, error 10007 returns.

Request URL example

https://console.tim.qq.com/v4/group_open_http_svc/modify_group_member_info?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json

Request parameters

The following table lists and describes only the parameters to be modified when this API is invoked. For details on other parameters, see RESTful API Overview.

Parameter Description
v4/group_open_http_svc/modify_group_member_info Request API
sdkappid SDKAppID assigned by the IM console when an app is created
identifier It must be the app admin account. For details, see App Admins.
usersig The signature generated by the app admin account. For details, see Generating UserSig.
random Enter a random 32-bit unsigned integer ranging from 0 to 4294967295.

Maximum invocation frequency

The maximum invocation frequency is 200 times per second.

Request packet examples

  • Setting an admin
    Sets a specified group member as an admin.

    {
      "GroupId": "@TGS#2CLUZEAEJ", // Target group (required)
      "Member_Account": "bob", // Target group member (required)
      "Role": "Admin" // Set as the admin
    }
  • Canceling an admin
    Revokes a specified group member’s admin role.

    {
      "GroupId": "@TGS#2CLUZEAEJ", // Target group (required)
      "Member_Account": "bob", // Target group member (required)
      "Role": "Member" // Revoke the admin role
    }
  • Setting the message blocking type for a member
    Sets the message blocking type for a specified member. AcceptAndNotify: accept and notify. Discard: do not accept nor notify. AcceptNotNotify: accept but do not notify.

    {
      "GroupId": "@TGS#2CLUZEAEJ", // Target group (required)
      "Member_Account": "bob", // Target group member (required
      "MsgFlag": "AcceptAndNotify" // Message blocking type, which can be AcceptAndNotify, Discard, or AcceptNotNotify
    }
  • Setting the group name card for a specified member
    Sets the group name card for a specified member. The maximum length of the group name card is 50 bytes.

    {
      "GroupId": "@TGS#2CLUZEAEJ", // Target group (required)
      "Member_Account": "bob", // Target group member (required)
      "NameCard": "bob" // Group name card (optional)
    }
  • Setting a member custom field
    Sets a group member custom field. By default, AppMemberDefinedData is unavailable and needs to be enabled before use. For details, see the explanatory table of request packet fields.

    {
      "GroupId": "@TGS#2CLUZEAEJ", // Target group (required)
      "Member_Account": "bob", // Target group member (required)
      "AppMemberDefinedData": [ // Target member custom field (optional)
          {
              "Key":"MemberDefined1", // Key of the target group member custom field
              "Value":"ModifyData1" // Value of the custom field
          },
          {
              "Key":"MemberDefined3",
              "Value":"ModifyData3"
          }
      ]
    }
  • Setting a mute time for a specified group member
    Sets a mute time for a specified group member.

    {
      "GroupId": "@TGS#2CLUZEAEJ", // Target group (required)
      "Member_Account": "bob", // Target group member (required)
      "ShutUpTime":86400 // Mute time for the specified user, in seconds
    }

Request packet fields

Field Type Attribute Description
GroupId String Required The ID of the target group.
Member_Account String Required The target group member (required).
Role String Optional The role of the member. Admin: set as the admin. Member: revoke the admin role.
MsgFlag String Optional The message blocking type.
NameCard String Optional The group name card with a maximum length of 50 bytes.
AppMemberDefinedData Array Optional The group member custom field. By default, this field is unavailable and needs to be enabled before use. For details, see Group Systems.
ShutUpTime Integer Optional The mute time in seconds. 0: unmute.

Response packet example

{
    "ActionStatus": "OK",
    "ErrorInfo": "",
    "ErrorCode": 0
}

Response packet fields

Field Type Description
ActionStatus String The request processing result. OK: succeeded. FAIL: failed.
ErrorCode Integer The error code. 0: succeeded. Others: failed.
ErrorInfo String Error information.

Error Codes

Unless a network error (such as error 502) occurs, the HTTP return code for this API is always 200. ErrorCode and ErrorInfo in the response packet represent the actual error code and error information, respectively.
For common error codes (60000 to 79999), see Error Codes.
The following table describes the error codes specific to this API.

Error Code Description
10002 A server internal error occurred. In this case, try again.
10003 A request command keyword is invalid.
10004 A parameter is invalid. In this case, check whether request parameters are correct based on the error description.
10007 Operation permissions are insufficient. For example, an ordinary member in a public group attempts to remove a member from the group, but only the app admin has the permission to do so.
10010 The group does not exist or has been dismissed.
10015 The group ID is invalid. In this case, check whether the group ID is correct.
80001 The group member profile fails to pass the text security check. In this case, check whether the modified group member profile contains sensitive words.

API Commissioning Tool

Use the RESTful online commissioning tool for APIs to commission this API.

References

Obtaining group members’ detailed profiles (v4/group_open_http_svc/get_group_member_info)