Этот документ обновлен.
Перевод (Русский) еще не готов.
Последнее обновление (английский): 17 дек
Последнее обновление (Русский): 5 окт 2022 г.

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}"
ID аккаунта WhatsApp Business можно просмотреть здесь: Business Manager > Настройки компании > Аккаунты > Аккаунты WhatsApp Business. Нажмите нужный аккаунт. Откроется панель с информацией о нем, включая ID аккаунта.

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