setAgentGroups
Mutation Support API — POST https://support.api.gist.link/graphql
Assign a synced agent to support groups. The roster itself is auto-managed (mirrored from the auth user directory); groups are the only support-specific attribute an admin edits. ROLE_ADMIN.
Required permission
Section titled “Required permission”support:mutation:setAgentGroupsThe calling IAM key must hold this permission (or a wildcard that covers it:
support:mutation:* or support:*) and the access token
must have been minted with audience=support. See
Permissions.
Definition
Section titled “Definition”type Mutation { setAgentGroups(agentId: Int!, groupIds: [Int!]!): Agent!}Arguments
Section titled “Arguments”| Argument | Type | Required | Description |
|---|---|---|---|
agentId |
Int! |
Yes | — |
groupIds |
[Int!]! |
Yes | — |
Returns
Section titled “Returns”Agent! — see the Support types reference.
Example
Section titled “Example”curl https://support.api.gist.link/graphql \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H 'Content-Type: application/json' \ -d @- <<'JSON' { "query": "mutation SetAgentGroups($agentId: Int!, $groupIds: [Int!]!) { setAgentGroups(agentId: $agentId, groupIds: $groupIds) { id name email created_at updated_at } }", "variables": { "agentId": 10, "groupIds": [ 10 ] } }JSONconst response = await fetch('https://support.api.gist.link/graphql', { method: 'POST', headers: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ query: `mutation SetAgentGroups($agentId: Int!, $groupIds: [Int!]!) { setAgentGroups(agentId: $agentId, groupIds: $groupIds) { id name email created_at updated_at } }`, variables: { "agentId": 10, "groupIds": [ 10 ] }, }),});
const { data, errors } = await response.json();if (errors) throw new Error(errors[0].message);console.log(data);<?php
$payload = json_encode([ 'query' => 'mutation SetAgentGroups($agentId: Int!, $groupIds: [Int!]!) { setAgentGroups(agentId: $agentId, groupIds: $groupIds) { id name email created_at updated_at } }', 'variables' => json_decode('{"agentId":10,"groupIds":[10]}', true),]);
$ch = curl_init('https://support.api.gist.link/graphql');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . $accessToken, 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => $payload,]);
$result = json_decode(curl_exec($ch), true);curl_close($ch);
if (isset($result['errors'])) { throw new RuntimeException($result['errors'][0]['message']);}
var_dump($result['data']);import requests
response = requests.post( "https://support.api.gist.link/graphql", headers={ "Authorization": f"Bearer {access_token}", "Content-Type": "application/json", }, json={ "query": """mutation SetAgentGroups($agentId: Int!, $groupIds: [Int!]!) { setAgentGroups(agentId: $agentId, groupIds: $groupIds) { id name email created_at updated_at } }""", "variables": { "agentId": 10, "groupIds": [ 10 ] }, }, timeout=30,)body = response.json()if body.get("errors"): raise RuntimeError(body["errors"][0]["message"])print(body["data"])