2025-03-06 20:58:59 +03:00
|
|
|
---
|
|
|
|
|
sidebar_position: 6
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
|
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
|
|
|
|
|
|
# Set admin rights
|
|
|
|
|
Assigns the user as the group administrator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`Function SetAdminRights(Val AccessParameters, Val GroupID, Val UserID) Export`
|
|
|
|
|
|
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|
|
|
|-|-|-|-|-|
|
|
|
|
|
| AccessParameters | --access | Structure Of KeyAndValue | ✔ | Access parameters. See FormAccessParameters |
|
|
|
|
|
| GroupID | --group | String | ✔ | Group chat identifier |
|
|
|
|
|
| UserID | --user | String | ✔ | User ID to add |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Green API
|
|
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
|
:::tip
|
|
|
|
|
Method at API documentation: [SetGroupAdmin](https://green-api.com/docs/api/groups/SetGroupAdmin/)
|
|
|
|
|
:::
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
|
|
|
ApiUrl = "https://7105.api.greenapi.com";
|
|
|
|
|
MediaUrl = "https://7105.media.greenapi.com";
|
|
|
|
|
IdInstance = "71051...";
|
|
|
|
|
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
|
|
|
|
|
|
2025-03-18 10:00:47 +03:00
|
|
|
GroupID = "120363397584380843@g.us";
|
2025-03-06 20:58:59 +03:00
|
|
|
UserID = "123123123@c.us";
|
|
|
|
|
|
|
|
|
|
AccessParameters = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
|
|
|
|
|
Result = OPI_GreenAPI.SetAdminRights(AccessParameters, GroupID, UserID);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-18 10:00:47 +03:00
|
|
|
```json title="Result"
|
|
|
|
|
{
|
|
|
|
|
"setGroupAdmin": true,
|
|
|
|
|
"error": "participant not found"
|
|
|
|
|
}
|
|
|
|
|
```
|