Skip to main content

Create Post

Create a new post in a group's community feed.

Endpoint

POST /api/posts

Authentication

Required. The user must be a member of the target group (or a platform admin).

Request Body

ParameterTypeRequiredDescription
groupIdintegerYesThe group to create the post in
titlestringNoPost title
descriptionstringNoPost body (supports rich text / HTML)
typestringNoContent type: "article" (default), "video", "link"
videostringNoVideo URL
contentURIstringNoExternal link URL
featuredImagestringNoFeatured image path/URL
durationintegerNoVideo duration in seconds
isLiveStreambooleanNoWhether this post is a live stream
streamIdstringNoLive stream identifier
ctaBtnTextstringNoCall-to-action button text
ctaBtnUrlstringNoCall-to-action button URL
publishedDatestringNoISO date; future dates schedule the post
pinnedbooleanNoPin the post to the top of the feed
KeywordIdsint[]NoArray of keyword IDs to tag the post with
Keywordsstring[]NoArray of keyword names (looked up by group; alternative to KeywordIds)

Response

Success Response

Status Code: 201 Created

Returns the created post object with associations.

{
"id": 4213,
"title": "My new post",
"description": "<p>Hello everyone!</p>",
"type": "article",
"visibility": "group",
"isLiveStream": false,
"createdAt": "2024-08-15T14:22:33.000Z",
"updatedAt": "2024-08-15T14:22:33.000Z",
"User": {
"id": 6604,
"name": "Bruce van Zyl",
"photoUrl": "1639671861952.png",
"role": "admin"
},
"ContentGroups": [
{ "GroupId": 32, "type": "post", "pinned": false }
],
"Keywords": []
}

Error Responses

Status CodeDescription
400Missing groupId or invalid parameters
403Not a member of the group

Notes

  • When isLiveStream is true and the creator is a group admin, a push notification is automatically sent to all group members.
  • A WebSocket postCreated event is broadcast to the group.

Example

curl -X POST "https://api.tribesocial.io/api/posts" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-d '{
"groupId": 32,
"title": "My new post",
"description": "<p>Hello everyone!</p>",
"Keywords": ["Announcements"]
}'