Skip to main content

Publish content

Publish in the name of a profile of your community team, then let it react, vote or delete what it wrote. These endpoints need the CONTENT_WRITE permission, and the profile must be linked to your Dashboard. Members who signed up through your app are not linked unless the Octopus team linked them at your request, so you usually cannot publish in their name: create a profile with POST /v1/users if you have none.

How content published through the API is moderated​

Content you publish through the Connect API is treated like content your team publishes from the Dashboard:

  • it is not scanned by automatic moderation;
  • it is not checked against your community's banned words;
  • it is not subject to the posting limits that protect your community from spam.

You are responsible for what your integration publishes. The content can still be hidden or moderated afterwards, from the Dashboard or with POST /v1/messages/{id}/hide and /moderate.

Create a post​

POST /v1/messages/posts publishes a post in a topic.

Parameters

  • userId (required): the author, a linked member.
  • topicId (required): the topic to post in, from GET /v1/messages/topics.
  • text: the post's text. It may be left out on a post with an image, when your community allows image-only posts.
  • cta (optional): a call-to-action button, {"text": "...", "targetLink": "https://..."}.
  • poll (optional): a poll, {"answers": ["...", "..."]}, with 2 to 7 answers. See Add a poll.
  • imageBase64 or imageIds (optional): one image, or up to 10 photos. See Add photos.
  • videoId (optional): a video. See Add a video.
  • blockCommentsReplies (optional): true prevents everyone from commenting or replying.
  • discussionReplyPushEnabled (optional): false stops the push sent to members who took part in the post's discussions when someone replies after them. The post's author still gets a push for each comment, and a comment's author for each reply.
curl https://connect.octopuscommunity.com/v1/messages/posts \
--header "Authorization: Bearer $CONNECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"userId": "<USER_ID>",
"topicId": "<TOPIC_ID>",
"text": "Our new recipe is out: crispy canelés in 4 steps.",
"cta": {"text": "See the recipe", "targetLink": "https://example.com/recipes/canele"}
}'

The response is 201 Created with the post itself, its id at the top level (trimmed):

{
"id": "<POST_ID>",
"parentId": "<TOPIC_ID>",
"createdAt": 1763458800000,
"createdBy": {"userId": "<USER_ID>", "nickname": "The Recipe Team"},
"content": {
"text": "Our new recipe is out: crispy canelés in 4 steps.",
"button": {"text": "See the recipe", "targetLink": "https://example.com/recipes/canele"}
}
}

This is not the shape of GET /v1/messages/post, which wraps the same post in {"post": …, "firstCommentsPage": […], "cursor": …}: read the id directly from the create response. Keep it to comment on the post, react to it or moderate it later. Comments, replies and bridge posts are returned the same way, unwrapped.

info

A post is not idempotent: retrying a call that timed out can publish it twice. See Retries and idempotency.

Add a poll​

Add poll with 2 to 7 answers. A poll can be combined with an image or photos, but not with a video.

curl https://connect.octopuscommunity.com/v1/messages/posts \
--header "Authorization: Bearer $CONNECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"userId": "<USER_ID>",
"topicId": "<TOPIC_ID>",
"text": "Which recipe should we film next?",
"poll": {"answers": ["Canelés", "Madeleines", "Financiers"]}
}'

The answers come back with their ids in content.poll.answers, which members vote with (see Vote on a poll).

Add photos​

A post carries either:

  • one image in imageBase64: the jpg or png bytes, encoded in base64 in the request body;
  • or up to 10 photos in imageIds, in the order they show. Upload them first with POST /v1/media/images, then pass their imageIds.

The two cannot be combined, nor with a video. Each image may weigh up to 50 MB (limits.imageMaxBytes in GET /v1/config). A missing, oversized or unreadable photo is named by its position in the 400 message, for example imageIds[3].

curl https://connect.octopuscommunity.com/v1/messages/posts \
--header "Authorization: Bearer $CONNECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"userId": "<USER_ID>",
"topicId": "<TOPIC_ID>",
"text": "Behind the scenes of our photo shoot",
"imageIds": ["<IMAGE_ID_1>", "<IMAGE_ID_2>"]
}'
info

The post is created right away, but its images become visible to other members only once processed. Until then, as in the response to this call, an image URL is a signed link that expires after 24 hours: do not store it. Once processed, the URL is a plain CDN URL without expiry, which you can store (see Asynchronous processing).

Add a video​

Upload the video first with POST /v1/media/videos, then pass its videoId. A video cannot be combined with a poll, an image or photos, and only posts can carry one.

curl https://connect.octopuscommunity.com/v1/messages/posts \
--header "Authorization: Bearer $CONNECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{"userId": "<USER_ID>", "topicId": "<TOPIC_ID>", "text": "Watch the canelé recipe", "videoId": "<VIDEO_ID>"}'
info

The post is created right away, while the video is still being transcoded. Other members see the post once the video is READY; a video that FAILED never becomes visible. Follow it with content.videoStatus on the post, or with GET /v1/media/videos/{videoId}.

Upload media​

Photos and videos are not sent through the Connect API: you upload them straight to storage with a presigned URL, then attach them to a post by id. The media endpoints need either CONTENT_WRITE or SCHEDULING, since scheduled posts can carry media too.

Upload photos​

  1. Ask for upload URLs, giving the exact size in bytes of each photo, 1 to 10 per call:

    curl https://connect.octopuscommunity.com/v1/media/images \
    --header "Authorization: Bearer $CONNECT_API_KEY" \
    --header "Content-Type: application/json" \
    --data "{\"images\": [{\"sizeBytes\": $(wc -c < photo1.jpg)}, {\"sizeBytes\": $(wc -c < photo2.jpg)}]}"
    {
    "images": [
    {"imageId": "<IMAGE_ID_1>", "uploadUrl": "<UPLOAD_URL_1>", "expiresInSeconds": 3600},
    {"imageId": "<IMAGE_ID_2>", "uploadUrl": "<UPLOAD_URL_2>", "expiresInSeconds": 3600}
    ],
    "maxBytes": 52428800
    }
  2. PUT each photo's raw bytes (jpg or png) to its uploadUrl, in one request, without your Authorization header: the URL carries its own credentials.

    curl --upload-file photo1.jpg "<UPLOAD_URL_1>"
    curl --upload-file photo2.jpg "<UPLOAD_URL_2>"
  3. Attach the imageIds in imageIds on POST /v1/messages/posts or POST /v1/scheduled-posts, in the order the photos should show. Any member your key writes with can use them.

warning

The size you declare is signed into the URL: a body of any other size is refused. The URLs expire after one hour. Because the upload goes to AWS S3 and not to Octopus, a refused upload answers with an S3 XML error, typically SignatureDoesNotMatch (wrong size) or AccessDenied (expired URL).

Upload a video​

  1. Ask for an upload URL, giving the video's type, extension and exact size in bytes (5 GiB at most). Accepted types: video/mp4, video/quicktime (mov), video/x-msvideo (avi) and video/webm.

    curl https://connect.octopuscommunity.com/v1/media/videos \
    --header "Authorization: Bearer $CONNECT_API_KEY" \
    --header "Content-Type: application/json" \
    --data "{\"contentType\": \"video/mp4\", \"fileExtension\": \"mp4\", \"sizeBytes\": $(wc -c < recipe.mp4)}"
    {"videoId": "<VIDEO_ID>", "uploadUrl": "<UPLOAD_URL>", "expiresInSeconds": 3600, "maxBytes": 5368709120}
  2. PUT the raw bytes to uploadUrl in a single request (not multipart), with the Content-Type you declared and without your Authorization header:

    curl --upload-file recipe.mp4 --header "Content-Type: video/mp4" "<UPLOAD_URL>"
  3. Attach the videoId to a post or a scheduled post.

  4. Follow the transcoding until the video is READY or FAILED:

    curl "https://connect.octopuscommunity.com/v1/media/videos/<VIDEO_ID>" \
    --header "Authorization: Bearer $CONNECT_API_KEY"
    {"videoId": "<VIDEO_ID>", "status": "READY", "videoUrl": "...", "thumbnailUrl": "...", "width": 1080, "height": 1920, "durationMs": 42000}

    status is PROCESSING, READY or FAILED (with an error). A videoId that does not exist, or belongs to another community, is always reported as PROCESSING.

warning

Both the type and the size you declare are signed into the URL: an upload with another Content-Type or another size is refused with an S3 XML error (SignatureDoesNotMatch). The URL expires after one hour.

Create a bridge post​

A bridge post stands for one of your own objects, such as an article, a product or a recipe: members discuss it in the community, and its button sends them back to your object. POST /v1/messages/bridge-posts creates one from your backend, for example when you publish the article, so the post and its discussion exist before any member opens the app.

The mobile SDKs create the same posts from inside the app (see Bridges). Both key on your object id, clientObjectId, so they meet at the same post: whichever comes first creates it, and the other gets it back.

Parameters

  • userId (required): the author, a linked member.
  • topicId (required): the topic of the post. Unlike in the SDKs, where the group (topic) is optional, it is mandatory here.
  • clientObjectId (required): your own id for the object. Use the same value as your app passes to the SDK.
  • text (required): the text of the post.
  • catchPhrase (optional): a short line shown in bold under the text, inviting members to react.
  • cta (optional): the button, {"text": "...", "targetLink": "..."}. text is limited to 28 characters. To give your own label per language, add textLanguage (the language of text) and textTranslations (your labels for other languages, such as {"fr": "Lire l'article"}); other readers see text translated automatically.
  • imageBase64 or imageUrls (optional): one image in base64, or up to 10 photos by their public URLs (jpg, png, webp or gif), downloaded when the post is created.

Polls and videos are not supported on bridge posts.

curl https://connect.octopuscommunity.com/v1/messages/bridge-posts \
--header "Authorization: Bearer $CONNECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"userId": "<USER_ID>",
"topicId": "<TOPIC_ID>",
"clientObjectId": "recipe-canele",
"text": "Crispy canelés in 4 steps",
"catchPhrase": "Tried them? Tell us how they turned out!",
"cta": {"text": "Read the recipe", "targetLink": "https://example.com/recipes/canele"},
"imageUrls": ["https://example.com/images/canele.jpg"]
}'

The call is idempotent on clientObjectId: 201 Created means the post was created, 200 OK that it already existed, and it is returned unchanged. Read it back at any time with GET /v1/messages/post?clientObjectId=.

tip

Avoid deleting and recreating the bridge post of an object: a new post starts with no comments, reactions or counters, and each object id supports a limited number of delete-and-recreate cycles.

Comment and reply​

POST /v1/messages/comments comments on a post, and POST /v1/messages/replies replies to a comment.

Parameters

  • userId (required): the author, a linked member.
  • postId (comments) or commentId (replies) (required): the message to answer.
  • text (required): the text.
  • imageBase64 (optional): one image, as on a post.
curl https://connect.octopuscommunity.com/v1/messages/comments \
--header "Authorization: Bearer $CONNECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{"userId": "<USER_ID>", "postId": "<POST_ID>", "text": "Thanks for trying it! Bake them 10 minutes longer for a darker crust."}'

curl https://connect.octopuscommunity.com/v1/messages/replies \
--header "Authorization: Bearer $CONNECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{"userId": "<USER_ID>", "commentId": "<COMMENT_ID>", "text": "Great idea, we will add it to the recipe."}'

The response is 201 Created with the comment or reply. A post or comment that was moderated answers 410 Gone.

React to a message​

PUT /v1/messages/{id}/reaction sets a member's reaction on a post, comment or reply. A member has one reaction per message, so a new one replaces the previous one. The emoji must be one of the reactions of GET /v1/config.

curl --request PUT "https://connect.octopuscommunity.com/v1/messages/<MESSAGE_ID>/reaction" \
--header "Authorization: Bearer $CONNECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{"userId": "<USER_ID>", "reaction": "👏"}'

DELETE /v1/messages/{id}/reaction?userId= removes it. It answers 204 even when the member had no reaction, so you can call it without checking first.

curl --request DELETE "https://connect.octopuscommunity.com/v1/messages/<MESSAGE_ID>/reaction?userId=<USER_ID>" \
--header "Authorization: Bearer $CONNECT_API_KEY"

Reaction counts update asynchronously: metrics.reactions catches up a moment later.

Vote on a poll​

PUT /v1/messages/{id}/vote records a member's vote on the poll of a post. pollAnswerId is one of the ids in content.poll.answers of the post.

curl --request PUT "https://connect.octopuscommunity.com/v1/messages/<POST_ID>/vote" \
--header "Authorization: Bearer $CONNECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{"userId": "<USER_ID>", "pollAnswerId": "<POLL_ANSWER_ID>"}'
{"id": "<POST_ID>", "userId": "<USER_ID>", "pollAnswerId": "<POLL_ANSWER_ID>", "alreadyVoted": false}

A vote cannot be changed or removed. When the member already voted, the call changes nothing and returns their original answer. alreadyVoted is true only when that answer differs from the one you sent: repeating the same vote returns false, so false does not prove that a new vote was recorded. Results update asynchronously in metrics.pollResults.

Delete a message​

DELETE /v1/messages/{id} deletes a post, comment or reply, acting as its author. It answers 204 No Content.

curl --request DELETE "https://connect.octopuscommunity.com/v1/messages/<MESSAGE_ID>" \
--header "Authorization: Bearer $CONNECT_API_KEY"

You can only delete messages whose author is linked to your Dashboard, such as content your integration published. To remove another member's content, moderate it with POST /v1/messages/{id}/moderate, or hide it from the feeds with POST /v1/messages/{id}/hide.