Tickets: list ticket types, create, read, update, and search with
starting_after paging. A ticket's type decides its
ticket_attributes (default _default_title_ and
_default_description_, plus any custom attributes the type defines).
Context Vars
intercom.token
Functions
build-create-body
fn (ticket-type-id: Str, contacts: Vec, options: Map): Map
Build the create body: ticket_type_id, contacts ([{id}],
[{external_id}] or [{email}]), plus options (ticket_attributes,
company_id, conversation_to_link_id, assignment: {admin_assignee_id, team_assignee_id}, created_at). Unset options are
omitted. Exposed for testing.
Example
::intercom::tickets/build-create-body("1234", [{email: "ada@example.com"}], {company_id: "acme-42"})
// {company_id: "acme-42", ticket_type_id: "1234", contacts: [{email: "ada@example.com"}]}
create-ticket
fn (ticket-type-id: Str, contacts: Vec): Any
fn (ticket-type-id: Str, contacts: Vec, options: Map): Any
fn (ticket-type-id: Str, contacts: Vec, options: Map, opts: Map): Any
POST /tickets - Create a ticket.
Example
::intercom::tickets/create-ticket("1234", [{email: "ada@example.com"}], {
ticket_attributes: {_default_title_: "Export fails", _default_description_: "CSV export times out after 30s."}
})
get-ticket
fn (id: Str): Any
fn (id: Str, opts: Map): Any
GET /tickets/{id} - One ticket.
Example
ticket ::intercom::tickets/get-ticket("6031")
ticket.ticket_attributes
get-ticket-type
fn (id: Str): Any
fn (id: Str, opts: Map): Any
GET /ticket_types/{id} - One ticket type with its attribute definitions.
Example
type-info ::intercom::tickets/get-ticket-type("1234")
type-info.name
list-ticket-states
fn (): Any
fn (opts: Map): Any
GET /ticket_states - The workspace's ticket states (ids for
update-ticket's ticket_state_id).
Example
states ::intercom::tickets/list-ticket-states()
map(states.data, %.id)
list-ticket-types
fn (): Any
fn (opts: Map): Any
GET /ticket_types - The workspace's ticket types (including archived
ones) with their attributes: {type: "list", data: [...]}.
Example
types ::intercom::tickets/list-ticket-types()
map(types.data, %.name)
search-all-tickets
fn (query: Map, limit: Int): Vec
fn (query: Map, limit: Int, opts: Map): Vec
Run search-tickets across pages until limit tickets or the last
page. Returns a Vec.
Example
tickets ::intercom::tickets/search-all-tickets({field: "ticket_type_id", operator: "=", value: "1234"}, 500)
length(tickets)
search-tickets
fn (query: Map): Any
fn (query: Map, options: Map): Any
fn (query: Map, options: Map, opts: Map): Any
POST /tickets/search - One page of tickets matching a query ({field, operator, value} or an AND/OR combinator over fields like state,
ticket_type_id, admin_assignee_id, created_at). options:
per_page, starting_after. Returns {tickets, pages, total_count}.
Example
page ::intercom::tickets/search-tickets({field: "ticket_type_id", operator: "=", value: "1234"}, {per_page: 50})
length(page.tickets)
update-ticket
fn (id: Str, changes: Map): Any
fn (id: Str, changes: Map, opts: Map): Any
PUT /tickets/{id} - Update ticket_attributes, ticket_state_id,
open, is_shared, snoozed_until, company_id, or assignment
(admin_id performing it plus assignee_id). Unset fields are omitted.
Example
::intercom::tickets/update-ticket("6031", {
ticket_attributes: {_default_title_: "Export fails on large files"},
open: true
})