Skip to main content
Using TypeScript? Check out our GraphQL SDK for a fully typed client.
Threads can be assigned to users or machine users. The latter is useful if you want a bot to handle or are building a complex automation of some kind.

Assigning a thread

To assign threads you need an API key with the following permissions:
  • thread:assign
  • thread:read
Mutation
mutation assignThread($input: AssignThreadInput!) {
  assignThread(input: $input) {
    thread {
      id
      status
    }
    error {
      message
      type
      code
      fields {
        field
        message
        type
      }
    }
  }
}
Variables
{
  "input": {
    "threadId": "th_01H8H46YPB2S4MAJM382FG9423",
    "userId": "u_01FSVKMHFDHJ3H5XFM20EMCBQN"

    // You could instead assign to a machine user by doing:
    // machineUserId: 'XXX'
  }
}

Unassigning threads

To unassign threads you need an API key with the following permissions:
  • thread:unassign
  • thread:read
Mutation
mutation unassignThread($input: UnassignThreadInput!) {
  unassignThread(input: $input) {
    thread {
      id
      status
    }
  }
}
Variables
{
  "input": {
    "threadId": "th_01H8H46YPB2S4MAJM382FG9423"
  }
}