Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.plain.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Using TypeScript? Check out our GraphQL SDK for a fully typed client.
Suggested replies (also called generated replies) allow you to programmatically add AI-generated or pre-composed reply suggestions to a thread. These suggestions are shown to the user in Plain so they can review and send them to the customer. This is useful if you are building your own AI integration or want to suggest replies based on your own logic, external knowledge bases, or automation workflows.

Adding a suggested reply

To add a suggested reply you need to provide the threadId, the timelineEntryId of the customer message you are responding to, and the markdown content of the reply. The timeline entry must be from a customer — suggested replies cannot be added against non-customer messages. 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. To add a suggested reply, you need an API key with the following permissions:
  • generatedReply:create
Mutation
mutation addGeneratedReply($input: AddGeneratedReplyInput!) {
  addGeneratedReply(input: $input) {
    generatedReply {
      id
      markdown
      timelineEntryId
      createdAt {
        iso8601
      }
      updatedAt {
        iso8601
      }
    }
    error {
      message
      type
      code
      fields {
        field
        message
        type
      }
    }
  }
}
Variables
{
  "input": {
    "threadId": "th_01H8H46YPB2S4MAJM382FG9423",
    "timelineEntryId": "t_01H8H46YPB2S4MAJM382FG9423",
    "markdown": "Hi there! Based on our documentation, you can reset your password by going to **Settings > Security > Reset password**. Let me know if you need any further help!"
  }
}