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.
Service level agreements (SLAs) commit you to responding to a customer within a certain time. SLAs are attached to a tier, which means every company or tenant belonging to that tier inherits them. Two types of SLA exist:
  • First response time — measured from when a thread is created until the first response is sent.
  • Next response time — measured each time the customer sends a new message, until a teammate responds.
SLAs can be scoped to specific thread priorities or labels, and can either be tracked 24/7 or only during your workspace’s business hours. These operations require the following permissions:
  • serviceLevelAgreement:create
  • serviceLevelAgreement:edit
  • serviceLevelAgreement:delete

Create an SLA

Provide either firstResponseTimeMinutes or nextResponseTimeMinutes (but not both — that creates a first-response SLA on one tier and a next-response SLA on the same tier with separate calls).
Mutation
mutation createServiceLevelAgreement($input: CreateServiceLevelAgreementInput!) {
  createServiceLevelAgreement(input: $input) {
    serviceLevelAgreement {
      __typename
      id
      useBusinessHoursOnly
      threadPriorityFilter
      ... on FirstResponseTimeServiceLevelAgreement {
        firstResponseTimeMinutes
      }
      ... on NextResponseTimeServiceLevelAgreement {
        nextResponseTimeMinutes
      }
    }
    error {
      message
      type
      code
      fields {
        field
        message
        type
      }
    }
  }
}
Variables
{
  "input": {
    "tierId": "ti_01HXXXXXXXXXXXXXXXXXXXXXXX",
    "serviceLevelAgreement": {
      "firstResponseTimeMinutes": 60,
      "useBusinessHoursOnly": true,
      "threadPriorityFilter": [0, 1],
      "breachActions": [
        { "beforeBreachAction": { "beforeBreachMinutes": 15 } }
      ]
    }
  }
}

Update an SLA

Field-level wrapper inputs apply — pass { "value": ... } for the fields you want to update and omit the rest.
Mutation
mutation updateServiceLevelAgreement($input: UpdateServiceLevelAgreementInput!) {
  updateServiceLevelAgreement(input: $input) {
    serviceLevelAgreement {
      __typename
      id
      useBusinessHoursOnly
      threadPriorityFilter
      ... on FirstResponseTimeServiceLevelAgreement {
        firstResponseTimeMinutes
      }
      ... on NextResponseTimeServiceLevelAgreement {
        nextResponseTimeMinutes
      }
    }
    error {
      message
      type
      code
      fields {
        field
        message
        type
      }
    }
  }
}
Variables
{
  "input": {
    "serviceLevelAgreementId": "sla_01HXXXXXXXXXXXXXXXXXXXXXXX",
    "firstResponseTimeMinutes": { "value": 30 },
    "useBusinessHoursOnly": { "value": false }
  }
}

Delete an SLA

Mutation
mutation deleteServiceLevelAgreement($input: DeleteServiceLevelAgreementInput!) {
  deleteServiceLevelAgreement(input: $input) {
    serviceLevelAgreement {
      id
    }
    error {
      message
      type
      code
      fields {
        field
        message
        type
      }
    }
  }
}
Variables
{
  "input": {
    "serviceLevelAgreementId": "sla_01HXXXXXXXXXXXXXXXXXXXXXXX"
  }
}