diff --git a/openapi.yaml b/openapi.yaml index f69e364..ce6b86b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -162,7 +162,7 @@ tags: - name: Projects description: The primary organisational unit — every Story and Case belongs to a Project - name: Welcome Tours - description: Guided tours of Makerble's own pages for new colleagues, written by Makerble staff; Organisation Admins choose how strict they are + description: Guided tours of Makerble's own pages for new colleagues; Organisation Admins choose each team's stops, wording and how strict they are, and see who has finished - name: Announcements description: '"What''s new in Makerble" popups, written and scheduled by Makerble staff in Site Overview' - name: Albums @@ -947,11 +947,15 @@ paths: Changes only the fields sent. System Access users can change everything; a stop with `_destroy: true` is removed, and a stop without an `id` is added. - An Organisation Admin of the tour's Organisation can change only how strict it is, as their Welcome - journey settings page does: `mode` (`required` is "Mandatory", `optional` lets people skip or end it), - `start_skippable` ("People can skip the tour when it is first offered"), `later_limit` (how many times - someone can choose "I'll do this later", 1 to 10) and `skippable` on stops that ask for a click. Sending - anything else as an Organisation Admin is refused with 403. + An Organisation Admin of the tour's Organisation can change what their Welcome journey settings page + changes: `mode` (`required` is "Mandatory", `optional` lets people skip or end it), `start_skippable` + ("People can skip the tour when it is first offered"), `later_limit` (how many times someone can choose + "I'll do this later", 1 to 10), and for each stop, named by its `id` or its `stop_key`: `included` + (whether the tour shows it; an unticked stop keeps its wording for when it is ticked again), `body` (its + wording, up to 280 characters of plain text; empty means Makerble's `default_body`) and `skippable` (on + stops that ask for a click). A `stop_key` the tour doesn't have yet adds that stop. Essentials stops + (navbar_spaces, navbar_user) are always included. Only the fields sent change. Sending anything else as + an Organisation Admin is refused with 403. operationId: updateTour security: [{tokenAuth: []}] requestBody: @@ -965,6 +969,10 @@ paths: stops: - id: 678 skippable: true + - id: 679 + included: false + - stop_key: contacts_table + body: Every child you work with has a record here. responses: "200": description: The updated Welcome Tour @@ -980,6 +988,87 @@ paths: $ref: '#/components/responses/NotFound' "422": $ref: '#/components/responses/UnprocessableEntityList' + /tours/{id}/progress: + parameters: + - name: id + in: path + required: true + schema: + type: integer + get: + tags: [Welcome Tours] + summary: See who has finished a Welcome Tour + description: | + Who has finished the tour, as the Who has finished page shows it: the colleagues in the tour's Team + (everyone in the Organisation for its default tour), by name, each with their team, how far they have + got, how many times they have chosen "I'll do this later" and when they were last reminded. Only + colleagues (Organisation Admins, reporters and observers) are listed, never Contacts or active + participants. `summary` counts the same people: `average_minutes` counts only tours finished without + "I'll do this later". An Organisation Admin of the tour's Organisation, or a System Access user. + operationId: listTourProgress + security: [{tokenAuth: []}] + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PerPage' + responses: + "200": + description: Paginated colleagues and how far each has got + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedTourProgress' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + /tours/{id}/reminders: + parameters: + - name: id + in: path + required: true + schema: + type: integer + post: + tags: [Welcome Tours] + summary: Remind a colleague to finish their Welcome Tour + description: | + Emails a colleague who hasn't finished their Welcome Tour a link that opens it at the stop they reached, + as Send a reminder on the Who has finished page does. Each person can be reminded once every 7 days; + a second reminder sooner is refused with 422, saying when the next one can be sent, as is someone who + has finished or isn't a colleague in the Organisation. An Organisation Admin of the tour's Organisation, + or a System Access user. + operationId: createTourReminder + security: [{tokenAuth: []}] + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [user_id] + properties: + user_id: + type: integer + description: The colleague to remind + example: + user_id: 4567 + responses: + "201": + description: The reminder was sent + content: + application/json: + schema: + $ref: '#/components/schemas/TourReminder' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntityList' /organisations/{organisation_id}/welcome_journey_settings: parameters: - name: organisation_id @@ -15111,6 +15200,13 @@ components: skippable: type: boolean description: Whether a click stop shows Skip this stop + included: + type: boolean + description: Whether the tour shows this stop. An unticked stop keeps its wording for when it is ticked again. + default_body: + type: string + nullable: true + description: Makerble's wording for this stop, shown when `body` is empty TourInput: type: object properties: @@ -15146,10 +15242,16 @@ components: type: string stop_key: type: string + description: For an Organisation Admin, names the stop instead of `id`, and adds it if the tour doesn't have it title: type: string body: type: string + nullable: true + description: The stop's wording; empty means Makerble's default. Up to 280 characters for an Organisation Admin. + included: + type: boolean + description: Whether the tour shows this stop action_text: type: string after_text: @@ -15167,6 +15269,76 @@ components: type: array items: $ref: '#/components/schemas/Tour' + PaginatedTourProgress: + allOf: + - $ref: '#/components/schemas/PaginationEnvelope' + - type: object + properties: + summary: + $ref: '#/components/schemas/TourProgressSummary' + data: + type: array + items: + $ref: '#/components/schemas/TourProgress' + TourProgressSummary: + type: object + description: The tiles on the Who has finished page + properties: + finished: + type: integer + part_way: + type: integer + not_started: + type: integer + description: Not started, or skipped an optional tour + average_minutes: + type: number + nullable: true + description: Average minutes to finish, counting only tours finished without "I'll do this later" + TourProgress: + type: object + description: One colleague and how far they have got + properties: + user_id: + type: integer + name: + type: string + team: + type: string + nullable: true + description: The first of the Organisation's Teams they joined + status: + type: string + enum: [not_started, in_progress, deferred, completed, skipped] + description: deferred means they chose "I'll do this later" + tour: + type: string + description: As the page shows it, for example "Paused at stop 3 of 7" or "Finished" + later_used: + type: string + nullable: true + description: How many times they chose "I'll do this later" of how many allowed, on a mandatory tour + last_active_at: + type: string + format: date-time + nullable: true + reminded_at: + type: string + format: date-time + nullable: true + description: When they were last sent a reminder + TourReminder: + type: object + properties: + user_id: + type: integer + reminded_at: + type: string + format: date-time + next_reminder_from: + type: string + format: date-time + description: The earliest another reminder can be sent to them WelcomeJourneySettings: type: object properties: diff --git a/server.js b/server.js index 1d57e26..eb11a25 100644 --- a/server.js +++ b/server.js @@ -4057,7 +4057,7 @@ function buildDocsPage() {
A Welcome Tour is the guided tour of Makerble's own pages that a new colleague is offered after adding their name and photo. Each stop dims the page except one area, such as the Spaces menu or the Contacts table, and either waits for Next or asks the person to click something (action: click). A tour belongs to an Organisation and, optionally, one of its Teams; team_id: null is the Organisation's default tour. Only a live tour is shown, and each Team (and the default) has at most one.
Makerble staff (System Access) see and change every tour. An Organisation Admin sees their own Organisation's tours and can change only how strict they are: mode (required is shown as Mandatory), start_skippable, later_limit (how many times someone can choose "I'll do this later", 1 to 10) and skippable on click stops. Anyone else gets 403. How far each person has got isn't available through the API.
Makerble staff (System Access) see and change every tour. An Organisation Admin sees their own Organisation's tours and changes what their Welcome journey settings page changes: how strict a tour is (mode, where required is shown as Mandatory; start_skippable; later_limit, how many times someone can choose "I'll do this later", 1 to 10), and for each stop whether it is included, its wording (body, up to 280 characters; empty uses Makerble's default_body) and whether a click stop is skippable. Essentials stops are always included. They can also see who has finished a tour and send reminders. Anyone else gets 403.
Stop keys: navbar_spaces, navbar_user, focus_table, contacts_table, contacts_search, contacts_filters, events_table, event_guests.
_destroy: true on a stop removes it. An Organisation Admin can send mode, start_skippable, later_limit and stops: [{id, skippable}].")}
+ ], "Only the fields sent change. Staff can send everything, and _destroy: true on a stop removes it. An Organisation Admin can send mode, start_skippable, later_limit and stops: [{id or stop_key, included, body, skippable}]; a stop_key the tour doesn't have yet adds that stop.")}
+ ${endpointCard("GET", "/tours/{id}/progress", "See who has finished a Welcome Tour", true, [
+ { name: "id", in: "path", type: "integer", required: true, desc: "Welcome Tour ID" },
+ { name: "page", type: "integer", required: false, desc: "Page number" },
+ { name: "per_page", type: "integer", required: false, desc: "Records per page (default 10, max 200)" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "Paginated colleagues in the tour's Team (everyone for a default tour), each with status, tour (e.g. \"Paused at stop 3 of 7\"), later_used, last_active_at and reminded_at, plus a summary of finished, part-way, not started and average minutes" },
+ { code: "403", cls: "response-4xx", desc: "Not an Organisation Admin of its Organisation" },
+ { code: "404", cls: "response-4xx", desc: "Not found" }
+ ], "Colleagues only, never Contacts or active participants. average_minutes counts only tours finished without \"I'll do this later\".")}
+ ${endpointCard("POST", "/tours/{id}/reminders", "Remind a colleague to finish their Welcome Tour", true, [
+ { name: "id", in: "path", type: "integer", required: true, desc: "Welcome Tour ID" },
+ { name: "user_id", in: "body", type: "integer", required: true, desc: "The colleague to remind" }
+ ], [
+ { code: "201", cls: "response-2xx", desc: "Reminder emailed: user_id, reminded_at and next_reminder_from" },
+ { code: "403", cls: "response-4xx", desc: "Not an Organisation Admin of its Organisation" },
+ { code: "404", cls: "response-4xx", desc: "Not found" },
+ { code: "422", cls: "response-4xx", desc: "Already reminded in the last 7 days, already finished, or not a colleague in the Organisation" }
+ ], "Emails a link that opens the tour at the stop they reached. Once every 7 days per person.")}
${endpointCard("GET", "/organisations/{organisation_id}/welcome_journey_settings", "Get an Organisation's welcome journey settings", true, [
{ name: "organisation_id", in: "path", type: "integer", required: true, desc: "The Organisation (Charity) ID" }
], [