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
| Parameter | Type | Required | Description |
|---|---|---|---|
groupId | integer | Yes | The group to create the post in |
title | string | No | Post title |
description | string | No | Post body (supports rich text / HTML) |
type | string | No | Content type: "article" (default), "video", "link" |
video | string | No | Video URL |
contentURI | string | No | External link URL |
featuredImage | string | No | Featured image path/URL |
duration | integer | No | Video duration in seconds |
isLiveStream | boolean | No | Whether this post is a live stream |
streamId | string | No | Live stream identifier |
ctaBtnText | string | No | Call-to-action button text |
ctaBtnUrl | string | No | Call-to-action button URL |
publishedDate | string | No | ISO date; future dates schedule the post |
pinned | boolean | No | Pin the post to the top of the feed |
KeywordIds | int[] | No | Array of keyword IDs to tag the post with |
Keywords | string[] | No | Array 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 Code | Description |
|---|---|
| 400 | Missing groupId or invalid parameters |
| 403 | Not a member of the group |
Notes
- When
isLiveStreamistrueand the creator is a group admin, a push notification is automatically sent to all group members. - A WebSocket
postCreatedevent 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"]
}'