For TypeScript, the GraphQL SDK gives you a fully typed client for these operations.
Adding a suggested reply
To add a suggested reply you need to provide thethreadId, the timelineEntryId of the message you are responding to, and the markdown content of the reply.
The timeline entry must be a message, from either the customer or a machine user. Use the most recent inbound message on the thread. Notes, user replies and timeline events such as label or status changes are not valid targets.
A timelineEntryId identifies a single entry on a customer’s timeline (e.g. an email or chat message). You can get one by querying a thread’s timelineEntries connection, where each entry has an id you can use here.
The markdown field supports a maximum of 5,000 characters.
Your replies show even when suggested responses are turned off, and take precedence over Ari’s for the same message.
To add a suggested reply, you need an API key with the following permissions:
generatedReply:create
Mutation
Variables
Threads created through the API
A thread that your integration opens withcreateThread has its first message authored by your machine user, not by the customer. That message is a valid target, so an agent can suggest a reply on a thread it opened itself. Do not filter the timeline down to customer entries before you choose a timelineEntryId, or you will find no target on these threads.
