05/15/2024 15:19:45

Group

For detailed description of the union group process and the permission application process, please refer to Group Module.

I. The union binds groups (QQ)

The union president creates and binds QQ groups directly (permissions are required to use this function).

1.1 Interface name

/v2/group/create_bind_group

1.2 Request parameters

Parameter Type Description
openid string [Required] User's unique ID
token string [Required] User's login status
guild_id string [Required] Union ID
guild_name string [Required] union name
roleid string [Required] Role ID
zone_id string [Required] zone ID, which is the zone ID of the union here
partition string partition ID, which can be left blank and is temporarily useless
user_zone_id string User's zone ID (can be left blank). The president can transfer the ID to someone who is not in this zone, so the union's zone is not necessarily the user's zone. It can be left blank when it is the same as the union zone
user_name string User's nickname
areaid string The ID of the game area, which theoretically only has two values: 1: QQ, 2: WeChat, but may have many virtual values in the test environment

1.3 Return parameters

Parameter Type Description
ret int Return code 0: success, others: failure
msg string Detailed description of the return result
groupid string Group ID of the new group
group_name string Group name

1.4 Request example

  • Request

     {
          "openid":"D08BF5F51A67414795F602000B000000",
          "token":"6A27E8C2B4EB505BB6D4A230BDDEF00A",
          "guild_id":"2134",
          "guild_name":"testitop",
          "zone_id":"1",
          "roleid":"2"
      }
    
  • Returned package

      {
          "ret":0,
          "msg":"",
          "groupid":"735088906",
          "group_name":"testitop"
      }
    

II. Query group relationship (QQ or WeChat)

After the union has been bound to a group, this interface can be invoked to query information about the relationship between the user and the group. It can return such information (group owner, administrator, common member, and non-member) (you need to apply for permission when using it).

2.1 Interface name

/v2/group/get_group_rela_info

2.2 Request parameters

Parameter Type Description
openid string [Required] User's unique ID
token string [Required] User's login status
groupid string [Rrequired for QQ] group ID
guild_id string [Required for WeChat] Union ID

Warning: Don't confuse groupid and guild_id; the former is QQ group ID, and the latter is the Union ID in the game.

2.3 Return parameters

Parameter Type Description
ret int Return code 0: success, others: failure
msg string Detailed description of the return result
relation int The relation between the user and the group, 1: group owner, 2: administrator, 3: common member, 4: non-member. WeChat's value range can only be 3 or 4

2.4 Request example

  • Request

     {
         "openid":"D08BF5F51A67414795F602000B000000",
         "token":"6A27E8C2B4EB505BB6D4A230BDDEF00A",
         "groupid":"735088906"
     }
    
  • Returned package

     {
         "ret":0,
         "msg":"",
         "relation":1
     }
    

III. Join an existing group (QQ)

This interface is used for in-game union members to join a QQ group; before invoking this interface, invoke /v2/group/get_group_info interface to query whether the user is a group member; if the user is not a group member, the "Join Group" button (new) will be displayed (the user needs to apply for permission when using it).

3.1 Interface name

/v2/group/join_group

3.2 Request parameters

Parameter Type Description
openid string [Required] User's unique ID
token string [Required] User's login status
guild_id string [Required] Union ID
groupid string [Required] group ID
zone_id string [Required] Zone ID, which is the zone ID of the union here
roleid string [Required] Role ID
areaid string Used in the test environment: game area ID, which theoretically has only two values 1: QQ, 2: WeChat, but may have many virtual values in the test environment
partition string zone ID
user_zone_id string User zone ID; the union president can transfer the ID to someone who is not in this zone, so a union zone is not necessarily a user zone. The user zone ID can be left blank when the user zone is the same as the union zone

Warning: Don't confuse groupid and guild_id; the former is QQ group ID, and the latter is the Union ID in the game.

3.3 Return parameters

Parameter Type Description
ret int Return code 0: success, others: failure
msg string Detailed description of the return result

3.4 Request example

  • Request

     {
         "openid":"D08BF5F51A67414795F602000B000000",
         "token":"6A27E8C2B4EB505BB6D4A230BDDEF00A",
         "guild_id":"2134",
         "groupid":"706990493",
         "zone_id":"1"
     }
    
  • Returned package

      {
          "ret":0,
          "msg":""
      }
    

IV. Unbind groups (QQ or WeChat)

If the user voluntarily dissolves the trade union QQ group, the trade union and the trade union QQ group will not be automatically unbound.
PS: There are two ways for a group to cancel its binding relationship with the union:

  1. The union president invokes the unbinding interface to dissolve the relationship
    When a union member invokes the group joining interface, if he or she cannot query the group ID at this time, then he or she is thought to unbind the relationship by default
    If a QQ group is disbanded without any of the above operations, the binding relationship will not disappear automatically
  2. After the union president resigns, the new president can also unbind the relationship.

4.1 Interface name

/v2/group/unbind_group

4.2 Request parameters

Parameter Type Description
openid string [Required] User's unique ID
token string [Required] User's login status
channel_info object [Required] Channel-related parameters

channel_info field
QQ:

Parameter Type Description
guild_id string [Required] Union ID
guild_name string [Required] Union name
zone_id string [Required] Zone ID, which is the zone ID of the union here
roleid string [Required] Role ID
areaid string Used in the test environment: game area ID, which theoretically has only two values 1: QQ, 2: WeChat, but may have many virtual values in the test environment
user_zone_id string User zone ID; the union president can transfer the ID to someone who is not in this zone, so a union zone is not necessarily a user zone. The user zone ID can be left blank when the user zone is the same as the union zone

WeChat:

Parameter Type Description
guild_id string [Required] Union ID

4.3 Return parameters

Parameter Type Description
ret int Return code 0: success, others: failure
msg string Detailed description of the return result

4.4 Request example

  • Request

     {
         "openid":"D08BF5F51A67414795F602000B000000",
         "token":"6A27E8C2B4EB505BB6D4A230BDDEF00A",
         "channel_info":{
             "guild_id":"2135",
             "guild_name":"itopv2",
             "zone_id":"1"
         }
     }
    
  • Returned package

     {
         "ret":0,
         "msg":""
     }
    

V. Launch a QQ group list (QQ)

This interface is used to launch the created group list when the union president binds the union to the QQ groups created by him.

5.1 Interface name

/v2/group/get_group_list

5.2 Request parameters

Parameter Type Description
openid string [Required] User's unique ID
token string [Required] User's login status

5.3 Return parameters

Parameter Type Description
ret int Return code 0: success, others: failure
msg string Detailed description of the return result
group_list array a list of groups created by me

In group_list, each data contains a list of fields

Parameter Type Description
groupid string Group ID
group_name string Group name

5.4 Request example

  • Request

     {
         "openid":"D08BF5F51A67414795F602000B000000",
         "token":"6A27E8C2B4EB505BB6D4A230BDDEF00A"
     }
    
  • Returned package

      {
          "ret":0,
          "msg":"",
          "group_list":[{
                  "groupid":"735088906",
                  "group_name":"testitop"
          }]
      }
    

VI. Bind the created QQ groups (QQ)

This interface is used for the union president to bind the union to the QQ groups he has created; before invoking this interface, invoke /v2/group/get_group_list interface to launch the created group list.

6.1 Interface name

/v2/group/bind_existing_group

6.2 Request parameters

Parameter Type Description
openid string [Required] User's unique ID
token string [Required] User's login status
groupid string [Required] Group ID
group_name string [Required] Group name
guild_id string [Required] Union ID
zone_id string [Required] Zone ID, which is the zone ID of the union here
roleid string Role ID
partition string zone ID
user_zone_id string User zone ID; the union president can transfer the ID to someone who is not in this zone, so a union zone is not necessarily a user zone. The user zone ID can be left blank when the user zone is the same as the union zone
areaid string The ID of the game area, which theoretically only has two values: 1: QQ, 2: WeChat, but may have many virtual values in the test environment

Warning: Don't confuse groupid and guild_id; the former is QQ group ID, and the latter is the Union ID in the game.

6.3 Return parameters

Parameter Type Description
ret int Return code 0: success, others: failure
msg string Detailed description of the return result

6.4 Request example

  • Request

     {
         "openid":"D08BF5F51A67414795F602000B000000",
         "token":"6A27E8C2B4EB505BB6D4A230BDDEF00A",
         "guild_id":"2134",
         "groupid":"735088906",
         "group_name":"testitop",
         "zone_id":"1"
     }
    
  • Returned package

     {
         "ret":0,
         "msg":""
     }
    

VII. Remind the president to bind groups (QQ)

This interface is used for union members to remind the union president to bind a group when the union is not bound to the group; let the union bind the QQ group I have created, so that I can receive notifications through the Official Account "QQ Mobile Games" but is limited to receive only one notification per day; it is needed to verify that the reminder and the reminded one must be union members, and the game side ensures that the reminded one is the union president.

7.1 Interface name

/v2/group/remind_leader_bind

7.2 Request parameters

Parameter Type Description
openid string [Required] User's unique ID
token string [Required] User's login status
guild_id string [Required] Union ID
roleid string [Required] Role ID
leader_openid string [Required] openId of the union president
leader_roleid string [Required] Role ID
zone_id string [Required] Zone ID, which is the zone ID of the union here
rolename string Role name, used for message text
leader_zone_id string The union president's zone ID; the president can transfer the ID to someone who is not in this zone; the field can be left blank when it is the same as the union zone ID
areaid string The ID of the game area, which theoretically only has two values: 1: QQ, 2: WeChat, but may have many virtual values in the test environment

7.3 Return parameters

Parameter Type Description
ret int Return code 0: success, others: failure
msg string Detailed description of the return result

7.4 Request example

  • Request

     {
         "openid":"D08BF5F51A67414795F602000B000000",
         "token":"6A27E8C2B4EB505BB6D4A230BDDEF00A",
         "guild_id":"2135",
         "roleid":"2",
         "leader_openid":"D08BF5F51A67414795F602000B000000",
         "leader_roleid":"2",
         "zone_id":"1"
     }
    
  • Returned package

     {
         "ret":0,
         "msg":""
     }
    

VIII. Launch group information (QQ or WeChat)

8.1 Interface name

/v2/group/get_group_info

8.2 Request parameters

Parameter Type Description
openid string [Required] User's unique ID
token string [Required] User's login status
channel_info object [Required] Channel-related parameters

channel_info
QQ:

Parameter Type Description
guild_id string [Required] Union ID
zone_id string [Required] Zone ID, which is the zone ID of the union here

WeChat:

Parameter Type Description
guild_id string [Required] Union ID

8.3 Return parameters

Parameter Type Description
ret int Return code 0: success, others: failure
msg string Detailed description of the return result
channel_info object Channel-related return

channel_info
QQ:

Parameter Type Description
groupid string Group ID
group_name string Group name
group_key string group_key of the QQ group bound to the game Union ID
group_openid string group_openid of the QQ group bound to the game Union ID

WeChat:

Parameter Type Description
is_has int 0 means that no group has been created, 1 means that a group has been created

8.4 Request example

  • Request

     {
         "openid":"D08BF5F51A67414795F602000B000000",
         "token":"6A27E8C2B4EB505BB6D4A230BDDEF00A",
         "channel_info":{
             "guild_id":"2135",
             "zone_id":"1"
         }
     }
    
  • Returned package

     {
         "ret":0,
         "msg":"",
         "channel_info":'{
             "groupid":"737550331",
             "group_name":"itopv2",
             "group_key":"hLG0YFQgoCIpQ-6_wo4yPXize0JbkzNu",
             "group_openid":"E571324A65B103B992714A6720DB4EBB"
         }
     }
    

XI. Send group messages (WeChat)

9.1 Interface name

/v2/group/send_group_msg

9.2 Request parameters

Parameter Type Description
openid string [Required] User's unique ID
token string [Required] User's login status
guild_id string [Required] Union ID
msg_type int [Required] message type, 1: structured sharing 2: link sharing
sub_type int [Required] Sharing type, invite 1, show off 2, give away 3, request 4
open object [Required] The specific message content, including fields; please see the description below

open field list

Parameter Type Description
title string title of the message
desc string introduction to the message
message_ext string extra field of the message
media_tag_name string distinguish game message types, used for statistics
url string hoplink, which is not required when msg_type is equal to 1, and is required when msg_type is equal to 2

9.3 Return parameters

Parameter Type Description
ret int Return code 0: success, others: failure
msg string Detailed description of the return result

X. Send group messages (QQ)

Games which invoke this interface need to apply for permission in QQ and configure the callback address. If a game does not apply for permission, invoking the interface will return {"is_lost":0,"msg":"invalid appid","ret":-2}.

10.1 Interface name

/v2/group/send_group_msg

10.2 Request parameters

Parameter Type Description
openid string [Required] User's unique ID
token string [Required] User's login status
pf string [Required] The source platform of the application (if you don't know the platform, you can fill in: qqqun)
group_openid string [Required] The openid of the group specified for sharing
title string [Required] Message title, up to 45 bytes
desc string [Required] Message summary, up to 60 bytes
image_url string [Required] URL of the thumbnail image to the left of the message
redirect_url string [Required] Callback address (the callback address configured when the game applies for interface permissions; don't fill in other domain name addresses)
param string [Required] The input parameter of redirect_url; the third party can skip to different detail pages according to this parameter (pass "" by default)

10.3 Return parameters

Parameter Type Description
ret int Return code 0: success, others: failure
msg string Detailed description of the return result

10.4 Request example

  • Request

     curl -X POST -H 'Content-Type: application/json' 'https://dev.itop.qq.com/v2/group/nnelid=2&gameid=12&os=1&seq=&source=0&ts=1557836202&version=2.0&sig=0fcb1dc59df246cc957224cfe337380f' -d '{"openid":"15879468368890148661","token":"935C4F643BC40AC88095429B1F063E07","pf":"qqqun","group_openid":"EE12810F82CE90426B23F2DCA8301738","title":"msdk test qq send group message","desc":"msdk test qq send group message","redirect_url":"http://docs.itop.qq.com","image_url":"https://avatars0.githubusercontent.com/u/3755338?s=460&v=4","param":"11"}'
    
  • Returned package

     {
         "ret":0,
         "msg":""
     }
    



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""