diff --git a/openapi.yaml b/openapi.yaml index 40f11c8..fede18d 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -213,6 +213,8 @@ tags: description: One record per Makerble feature holding its launch content, used by announcements and the feature launch emails; written by Makerble staff - name: Weekly Email description: The weekly email of feature announcements, prepared and approved by Makerble staff + - name: Social Posts + description: A feature launch's posts for Makerble's own LinkedIn company page, Instagram and X, reviewed and approved by Makerble staff - name: Feature Tours description: Short tours introducing one feature to people who already use Makerble, offered from a page's Intro or an announcement; written by Makerble staff - name: Staff Unavailability @@ -2287,6 +2289,284 @@ paths: $ref: '#/components/responses/NotFound' "422": $ref: '#/components/responses/UnprocessableEntityList' + /social_posts: + get: + tags: [Social Posts] + summary: List social posts + description: | + Lists social posts: a feature launch's posts for Makerble's own LinkedIn company page, Instagram and X, at most + one per channel for each launch. They are only ever about Makerble's feature launches, never an organisation's + data. Each has its copy (`body`), media, link, planned date and time, and a status: draft, approved, scheduled, + published or failed. Posts are listed by planned time, those without one last. + + Narrow the list with `feature_launch_id`, `channel`, `status` or `week` (any date in the week; weeks start on + Monday), as Site Overview › Social posts shows them. System Access users (Makerble staff) only. Anyone else + gets 403. + operationId: listSocialPosts + security: [{tokenAuth: []}] + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PerPage' + - $ref: '#/components/parameters/LastSyncDatetime' + - name: feature_launch_id + in: query + required: false + description: Only the posts for this feature launch. + schema: + type: integer + - name: channel + in: query + required: false + schema: + type: string + enum: [linkedin, instagram, x] + - name: status + in: query + required: false + schema: + type: string + enum: [draft, approved, scheduled, published, failed] + - name: week + in: query + required: false + description: Only posts planned in the week (Monday to Sunday) holding this date, such as 2026-12-07. + schema: + type: string + format: date + responses: + "200": + description: Paginated social posts + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedSocialPosts' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "422": + $ref: '#/components/responses/UnprocessableEntityList' + post: + tags: [Social Posts] + summary: Create a social post + description: | + Creates a draft post for one channel of a feature launch, as Site Overview › Social posts does. A launch can + have one post per channel. Each channel's rules are checked: + + - X: at most 280 characters, counting a link as 23 (as X does). + - Instagram: only for Major feature launches; needs media; at most 2,200 characters. Its link isn't clickable + in a caption, so a post with a link must say the setting's wording, "link in bio" unless changed (see + GET /social_post_settings). + - LinkedIn: at most 3,000 characters, and an image or GIF rather than a video. + + Leave out `planned_at` and it is 10:00 UK time on the start date of the launch's first Makerble announcement; + leave out `link_url` and it is the blog post for a Major launch, otherwise the launch's deep link. Send either + as null to leave it empty. The post is a draft until someone approves it (POST /social_posts/{id}/approve). + System Access users only. + operationId: createSocialPost + security: [{tokenAuth: []}] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SocialPostCreateInput' + example: + feature_launch_id: 12 + channel: linkedin + body: >- + Registers are here. Tick people off as they arrive at each session, and the numbers flow straight into + your reports. + media: gif + media_alt: A register being ticked off as people arrive + multipart/form-data: + schema: + $ref: '#/components/schemas/SocialPostCreateInput' + responses: + "201": + description: The created social post + content: + application/json: + schema: + $ref: '#/components/schemas/SocialPost' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "422": + $ref: '#/components/responses/UnprocessableEntityList' + /social_posts/{id}: + parameters: + - name: id + in: path + required: true + schema: + type: integer + get: + tags: [Social Posts] + summary: Get a social post + description: One social post. System Access users only. + operationId: getSocialPost + security: [{tokenAuth: []}] + responses: + "200": + description: The social post + content: + application/json: + schema: + $ref: '#/components/schemas/SocialPost' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + patch: + tags: [Social Posts] + summary: Update a social post + description: | + Changes only the fields sent; send null or an empty string to clear one. The channel can't be changed. + Changing an approved post sends it back to draft, so it is approved again as it will go out. A published post + can't be changed. An `image` sent replaces the saved one, and changing `media` away from `image` removes it. + System Access users only. + operationId: updateSocialPost + security: [{tokenAuth: []}] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SocialPostInput' + example: + body: Registers are here. Tick people off as they arrive. Link in bio. + planned_at: '2026-12-07T10:00:00Z' + multipart/form-data: + schema: + $ref: '#/components/schemas/SocialPostInput' + responses: + "200": + description: The updated social post + content: + application/json: + schema: + $ref: '#/components/schemas/SocialPost' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntityList' + /social_posts/{id}/approve: + parameters: + - name: id + in: path + required: true + schema: + type: integer + post: + tags: [Social Posts] + summary: Approve a social post + description: | + Approves a draft, as the Approve button does, recording who approved it and when. It must pass its channel's + rules and have a planned time. With the setting "Publish once approved" (the default), only approved posts are + published. System Access users only. + operationId: approveSocialPost + security: [{tokenAuth: []}] + responses: + "200": + description: The approved social post + content: + application/json: + schema: + $ref: '#/components/schemas/SocialPost' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntityList' + /social_posts/{id}/send_back: + parameters: + - name: id + in: path + required: true + schema: + type: integer + post: + tags: [Social Posts] + summary: Send a social post back to draft + description: | + Sends an approved or failed post back to draft, as the Send back to draft button does. A draft, scheduled or + published post can't be sent back. System Access users only. + operationId: sendBackSocialPost + security: [{tokenAuth: []}] + responses: + "200": + description: The social post, now a draft + content: + application/json: + schema: + $ref: '#/components/schemas/SocialPost' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntityList' + /social_post_settings: + get: + tags: [Social Posts] + summary: Get the social post settings + description: | + How social posts are published: `once_approved` (the default, because they go out from Makerble's public + company profiles) publishes only approved posts; `automatically` publishes drafts too when their planned time + comes. Also the wording Instagram captions use instead of a link. System Access users only. + operationId: getSocialPostSettings + security: [{tokenAuth: []}] + responses: + "200": + description: The settings + content: + application/json: + schema: + $ref: '#/components/schemas/SocialPostSettings' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + patch: + tags: [Social Posts] + summary: Update the social post settings + description: Changes only the fields sent. System Access users only. + operationId: updateSocialPostSettings + security: [{tokenAuth: []}] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SocialPostSettingsInput' + example: + publish_mode: once_approved + responses: + "200": + description: The updated settings + content: + application/json: + schema: + $ref: '#/components/schemas/SocialPostSettings' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "422": + $ref: '#/components/responses/UnprocessableEntityList' /feature_tours: get: tags: [Feature Tours] @@ -26442,6 +26722,159 @@ components: type: array items: $ref: '#/components/schemas/FeatureLaunch' + SocialPost: + type: object + description: A feature launch's post for one of Makerble's social channels + properties: + id: + type: integer + feature_launch_id: + type: integer + feature_launch_name: + type: string + channel: + type: string + enum: [linkedin, instagram, x] + description: LinkedIn (Makerble's company page), Instagram or X. + body: + type: string + description: The post's copy. + media: + type: string + enum: [none, still_frame, gif, video, image] + description: >- + What the post shows: the feature launch's still frame, GIF or video (made from its animation), an image + uploaded for the post, or nothing. + media_alt: + type: string + nullable: true + maxLength: 250 + description: What the media shows, for screen readers. Required unless `media` is `none`. + media_url: + type: string + nullable: true + description: The media file, once there is one. + link_url: + type: string + nullable: true + maxLength: 2048 + planned_at: + type: string + format: date-time + nullable: true + description: When the post is planned to go out. Needed before it can be approved. + status: + type: string + enum: [draft, approved, scheduled, published, failed] + approved_by_id: + type: integer + nullable: true + approved_at: + type: string + format: date-time + nullable: true + created_by_id: + type: integer + nullable: true + updated_by_id: + type: integer + nullable: true + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + required: [id, feature_launch_id, feature_launch_name, channel, body, media, media_alt, media_url, link_url, planned_at, status, + approved_by_id, approved_at, created_by_id, updated_by_id, created_at, updated_at] + SocialPostInput: + type: object + properties: + body: + type: string + description: The post's copy, within the channel's limit. + media: + type: string + enum: [none, still_frame, gif, video, image] + description: >- + The feature launch's still frame, GIF or video (the launch must have it already), an uploaded `image`, or + nothing. Instagram needs media; LinkedIn takes an image or GIF, not a video. + media_alt: + type: string + nullable: true + maxLength: 250 + image: + description: >- + The image for `media: image`: a PNG, JPG, GIF or WebP of up to 5 MB, as a multipart file or as an object + with `filename` and base64 `data`. + oneOf: + - type: string + format: binary + - type: object + properties: + filename: + type: string + data: + type: string + format: byte + required: [filename, data] + link_url: + type: string + nullable: true + maxLength: 2048 + description: A web address starting https://. + planned_at: + type: string + format: date-time + nullable: true + SocialPostCreateInput: + allOf: + - $ref: '#/components/schemas/SocialPostInput' + - type: object + properties: + feature_launch_id: + type: integer + description: The feature launch (from GET /feature_launches) the post is for. + channel: + type: string + enum: [linkedin, instagram, x] + required: [feature_launch_id, channel, body] + PaginatedSocialPosts: + allOf: + - $ref: '#/components/schemas/PaginationEnvelope' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/SocialPost' + SocialPostSettings: + type: object + properties: + publish_mode: + type: string + enum: [once_approved, automatically] + description: once_approved publishes only approved posts; automatically publishes drafts too. + instagram_link_wording: + type: string + maxLength: 60 + description: What an Instagram caption with a link must say, since its link isn't clickable. + updated_by_id: + type: integer + nullable: true + updated_at: + type: string + format: date-time + required: [publish_mode, instagram_link_wording, updated_by_id, updated_at] + SocialPostSettingsInput: + type: object + properties: + publish_mode: + type: string + enum: [once_approved, automatically] + instagram_link_wording: + type: string + maxLength: 60 FeatureTour: type: object description: A feature tour and its stops in order diff --git a/server.js b/server.js index a07eed0..0b548a5 100644 --- a/server.js +++ b/server.js @@ -1007,6 +1007,7 @@ function buildDocsPage() { POSTWishlist POSTWelcome Tours POSTFeature Launches + POSTSocial Posts POSTWeekly Email POSTFeature Tours POSTTraining Materials @@ -6179,6 +6180,80 @@ function buildDocsPage() { + +
+
Integrations
+

Social Posts

+
+

A social post is a feature launch's post for Makerble's own LinkedIn company page, Instagram or X: at most one per channel (linkedin, instagram or x) for each launch. Social posts are only ever about Makerble's feature launches, never an organisation's data. Each has its copy (body), media (the launch's still_frame, gif or video, an uploaded image, or none) with media_alt and media_url, a link_url, a planned_at time and a status: draft, approved, scheduled, published or failed. Makerble staff review them in Site Overview › Social posts.

+

Channel rules, checked on every save: X allows 280 characters, counting a link as 23 (as X does). Instagram is for Major feature launches only, needs media and allows 2,200 characters. A caption's link isn't clickable, so an Instagram post with a link must say the settings' instagram_link_wording ("link in bio" to start with). LinkedIn allows 3,000 characters and an image or GIF, not a video.

+

A new post's planned_at defaults to 10:00 UK time on the start date of the launch's first announcement, and its link_url to the blog post for a Major launch, otherwise the launch's deep link. A post must have a planned_at before it can be approved, and changing an approved post sends it back to draft. With publish_mode once_approved (the default) only approved posts are published; automatically publishes drafts too. System Access users (Makerble staff) only; anyone else gets 403.

+
+
+ ${endpointCard("GET", "/social_posts", "List social posts", true, [ + { name: "feature_launch_id", type: "integer", required: false, desc: "Only this feature launch's posts" }, + { name: "channel", type: "string", required: false, desc: "linkedin, instagram or x" }, + { name: "status", type: "string", required: false, desc: "draft, approved, scheduled, published or failed" }, + { name: "week", type: "string", required: false, desc: "Only posts planned in the week (Monday to Sunday) holding this date, e.g. 2026-12-07" }, + { name: "page", type: "integer", required: false, desc: "Page number" }, + { name: "per_page", type: "integer", required: false, desc: "Records per page (default 10, max 200)" }, + { name: "last_synced_datetime", type: "string", required: false, desc: "ISO 8601 incremental sync" } + ], [ + { code: "200", cls: "response-2xx", desc: "Paginated social posts, by planned time, those without one last" }, + { code: "403", cls: "response-4xx", desc: "The user doesn't have System Access" }, + { code: "422", cls: "response-4xx", desc: "week isn't a date" } + ])} + ${endpointCard("GET", "/social_posts/{id}", "Get a social post", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Social post ID" } + ], [ + { code: "200", cls: "response-2xx", desc: "The social post" }, + { code: "403", cls: "response-4xx", desc: "The user doesn't have System Access" }, + { code: "404", cls: "response-4xx", desc: "Not found" } + ])} + ${endpointCard("POST", "/social_posts", "Create a social post", true, [], [ + { code: "201", cls: "response-2xx", desc: "Social post created as a draft" }, + { code: "403", cls: "response-4xx", desc: "The user doesn't have System Access" }, + { code: "422", cls: "response-4xx", desc: "Validation failed, e.g. the launch already has a post for that channel, the copy is too long for the channel, or an Instagram post has no media" } + ], "Body: feature_launch_id (required), channel (required), body (required), media, media_alt (required unless the media is none), image (for image: a file in a multipart/form-data request, or {filename, data} in base64), link_url (https), planned_at (ISO 8601). Send link_url or planned_at as null to leave it empty instead of taking the default.")} + ${endpointCard("PATCH", "/social_posts/{id}", "Update a social post", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Social post ID" } + ], [ + { code: "200", cls: "response-2xx", desc: "Social post updated" }, + { code: "403", cls: "response-4xx", desc: "The user doesn't have System Access" }, + { code: "404", cls: "response-4xx", desc: "Not found" }, + { code: "422", cls: "response-4xx", desc: "Validation failed, or the post is published" } + ], "Only the fields sent change; null or an empty string clears one. The channel can't change. Changing an approved post sends it back to draft. A new image replaces the saved one, and changing media away from image removes it.")} + ${endpointCard("POST", "/social_posts/{id}/approve", "Approve a social post", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Social post ID" } + ], [ + { code: "200", cls: "response-2xx", desc: "The post, now approved, with who approved it and when" }, + { code: "403", cls: "response-4xx", desc: "The user doesn't have System Access" }, + { code: "404", cls: "response-4xx", desc: "Not found" }, + { code: "422", cls: "response-4xx", desc: "Not a draft, no planned time, or it breaks its channel's rules" } + ])} + ${endpointCard("POST", "/social_posts/{id}/send_back", "Send a social post back to draft", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Social post ID" } + ], [ + { code: "200", cls: "response-2xx", desc: "The post, now a draft" }, + { code: "403", cls: "response-4xx", desc: "The user doesn't have System Access" }, + { code: "404", cls: "response-4xx", desc: "Not found" }, + { code: "422", cls: "response-4xx", desc: "Only an approved or failed post can be sent back" } + ])} + ${endpointCard("GET", "/social_post_settings", "Get the social post settings", true, [], [ + { code: "200", cls: "response-2xx", desc: "publish_mode and instagram_link_wording" }, + { code: "403", cls: "response-4xx", desc: "The user doesn't have System Access" } + ])} + ${endpointCard("PATCH", "/social_post_settings", "Update the social post settings", true, [ + { name: "publish_mode", in: "body", type: "string", required: false, desc: "once_approved or automatically" }, + { name: "instagram_link_wording", in: "body", type: "string", required: false, desc: "What an Instagram post with a link must say, up to 60 characters" } + ], [ + { code: "200", cls: "response-2xx", desc: "The settings after the change" }, + { code: "403", cls: "response-4xx", desc: "The user doesn't have System Access" }, + { code: "422", cls: "response-4xx", desc: "Not an allowed value" } + ])} +
+
+
Integrations