addMessage
Mutation Support API — POST https://support.api.gist.link/graphql
Post a reply on a ticket. ROLE_SUPPORT_AGENT/ROLE_ADMIN may post public or internal (isPublic: false) replies on any ticket; other authenticated users (requesters) may only post public replies (isPublic forced true; passing false is an error) and only on their own ticket. Attachments must be finalized Drive attachment URLs from finalizeAttachment. Agents may pass includeSignature: true to append their resolved signature (see replySignature) to a public reply; it is ignored for internal notes and requesters.
Required permission
Section titled “Required permission”support:mutation:addMessageThe 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 { addMessage(ticketId: Int!, body: String!, isPublic: Boolean, attachments: [AttachmentInput!], includeSignature: Boolean): Message!}Arguments
Section titled “Arguments”| Argument | Type | Required | Description |
|---|---|---|---|
ticketId |
Int! |
Yes | — |
body |
String! |
Yes | — |
isPublic |
Boolean |
No | — |
attachments |
[AttachmentInput!] |
No | — |
includeSignature |
Boolean |
No | — |
Returns
Section titled “Returns”Message! — 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 AddMessage($ticketId: Int!, $body: String!, $isPublic: Boolean, $attachments: [AttachmentInput!], $includeSignature: Boolean) { addMessage(ticketId: $ticketId, body: $body, isPublic: $isPublic, attachments: $attachments, includeSignature: $includeSignature) { id ticket_id author_type author_name author_email body is_public created_at } }", "variables": { "ticketId": 10, "body": "example", "isPublic": true, "attachments": [ { "url": "example", "filename": "Example", "content_type": "example", "size": 10 } ], "includeSignature": true } }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 AddMessage($ticketId: Int!, $body: String!, $isPublic: Boolean, $attachments: [AttachmentInput!], $includeSignature: Boolean) { addMessage(ticketId: $ticketId, body: $body, isPublic: $isPublic, attachments: $attachments, includeSignature: $includeSignature) { id ticket_id author_type author_name author_email body is_public created_at } }`, variables: { "ticketId": 10, "body": "example", "isPublic": true, "attachments": [ { "url": "example", "filename": "Example", "content_type": "example", "size": 10 } ], "includeSignature": true }, }),});
const { data, errors } = await response.json();if (errors) throw new Error(errors[0].message);console.log(data);<?php
$payload = json_encode([ 'query' => 'mutation AddMessage($ticketId: Int!, $body: String!, $isPublic: Boolean, $attachments: [AttachmentInput!], $includeSignature: Boolean) { addMessage(ticketId: $ticketId, body: $body, isPublic: $isPublic, attachments: $attachments, includeSignature: $includeSignature) { id ticket_id author_type author_name author_email body is_public created_at } }', 'variables' => json_decode('{"ticketId":10,"body":"example","isPublic":true,"attachments":[{"url":"example","filename":"Example","content_type":"example","size":10}],"includeSignature":true}', 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 AddMessage($ticketId: Int!, $body: String!, $isPublic: Boolean, $attachments: [AttachmentInput!], $includeSignature: Boolean) { addMessage(ticketId: $ticketId, body: $body, isPublic: $isPublic, attachments: $attachments, includeSignature: $includeSignature) { id ticket_id author_type author_name author_email body is_public created_at } }""", "variables": { "ticketId": 10, "body": "example", "isPublic": true, "attachments": [ { "url": "example", "filename": "Example", "content_type": "example", "size": 10 } ], "includeSignature": true }, }, timeout=30,)body = response.json()if body.get("errors"): raise RuntimeError(body["errors"][0]["message"])print(body["data"])