visibility is WORKSPACE (every user in the workspace) or USER (the user who created it), and null until set.
For TypeScript, the GraphQL SDK gives you a fully typed client for these operations.
status is OPEN or RESOLVED. agentStatus reports what an agent is doing on the discussion.
The discussions query includes workflow tasks when you pass threadIds and leave isWorkflowTask unset. Thread.threadDiscussions returns the discussions on that thread and leaves workflow tasks out. To read message text, authors, and files, select messages. That field needs threadDiscussionMessage:read.
Slack and email discussions can be started in Plain. The API can open one too, such as a Slack discussion in #billing-support for every thread with the Billing label.
