文档已更新。
中文(简体) 译文尚未完成。
英语更新时间:12月17日
中文(简体) 更新时间:2023年8月29日

Manage System Users

Adding your System User to shared WhatsApp Business Accounts allows you to programmatically manage the accounts. On this guide, we go over actions BSPs may need to perform to manage their system users.

Retrieve System User IDs

You can cache the System User IDs for future use.

Request

curl -i -X GET "https://graph.facebook.com/v21.0/{business-id}/system_users
  ?access_token={system-user-access-token}"
To find the ID of a business, go to Business Manager > Business Settings > Business Info. There, you will see information about the business, including the ID.

Response

{
  "data": [
    {
      "id": "1972555232742222",
      "name": "My System User",
      "role": "EMPLOYEE"
    }
  ]
}

Add System Users to a WhatsApp Business Account

For this API call, you need to use the access token of a System User with admin permissions.

Request

In the following example, use the ID for the assigned WABA.

curl -i -X POST "https://graph.facebook.com/v21.0/{waba-id}/assigned_users
  ?user={assigned-user-id}
  &tasks=['{your-permissions or tasks}']
  &access_token={admin-system-user-access-token}"
如要获取 WhatsApp Business 商业帐号的编号,请前往商务管理平台 > 商业设置 > 帐号 > WhatsApp Business 商业帐号。找到您要使用的帐号,然后点击该帐号。系统随后将开启一个窗口,其中包含该帐号的编号等相关信息。

For the assigned-user-id, use the system user ID returned from your /{business-id}/system_users call.

Permissions

NameDescription

MANAGE**

Provides admin access.
Users can have admin access on a WhatsApp Business Account that is shared with Admin permissions.

DEVELOP

Provides developer access.
Users can have developer access on a WhatsApp Business Account that is shared with Standard permissions.

**Note: If you are trying to add a user to a WhatsApp Business Account that is shared with you via a Multi-Partner Solution you would have to use MANAGE_USERS to add the user to that account.

Response

{
  "success": true
}

Retrieve assigned users

You can fetch the assigned users of the WhatsApp Business Account to verify that the user was added. This is not a required step but helps with validation.

Request

In the following example, use the ID for the assigned WABA.

curl -i -X GET "https://graph.facebook.com/v21.0/{waba-id}/assigned_users
  ?business={business-id}
  &access_token={system-user-access-token}"

Response

{
  "data": [
    {
      "id": "1972385232742142",
      "name": "Anna Flex",
      "tasks": [
        "MANAGE"
      ]
    },
    {
      "id": "1972385232752545",
      "name": "Jasper Brown",
      "tasks": [
        "DEVELOP"
      ]
    }
  ]
}

See Also