What are Posts?
Posts are the primary content type in Mighty Networks. They represent user-generated content including text, images, videos, and other media shared within your network.
Posts can be:
- Created in specific spaces
- Visible to the entire network or specific spaces
- Commented on and reacted to
- Moderated by admins and hosts
Post Properties
Each post includes:
- Post ID - Unique identifier
- Content - Text content with rich formatting
- Author - Member who created the post
- Space - Where the post was created
- Media - Attached images, videos, or files
- Timestamps - Created and updated dates
- Engagement - Comments, reactions, and views
- Visibility - Public, members-only, or space-specific
Listing Posts
Get all posts in your network:
curl https://api.mn.co/admin/v1/networks/{network_id}/posts \
-H "Authorization: Bearer YOUR_API_TOKEN"
Example Response
{
"items": [
{
"id": 98765,
"body": "Welcome to our community! Excited to connect with everyone.",
"author_id": 12345,
"space_id": 456,
"created_at": "2024-03-20T14:30:00Z",
"updated_at": "2024-03-20T14:30:00Z",
"comments_count": 5,
"reactions_count": 12
}
],
"links": {
"self": "https://api.mn.co/admin/v1/networks/123/posts?page=1",
"next": "https://api.mn.co/admin/v1/networks/123/posts?page=2"
}
}
Getting a Specific Post
Retrieve details about a single post:
curl https://api.mn.co/admin/v1/networks/{network_id}/posts/{post_id}/ \
-H "Authorization: Bearer YOUR_API_TOKEN"
Creating Posts
Create a new post in your network:
curl -X POST https://api.mn.co/admin/v1/networks/{network_id}/posts \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"body": "This is my post content",
"space_id": 456
}'
Creating Posts with Notifications
You can optionally notify network members when creating a post:
curl -X POST "https://api.mn.co/admin/v1/networks/{network_id}/posts?notify=true" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"body": "Important announcement for all members!",
"space_id": 456
}'
Use the notify=true parameter to send push notifications and emails to network members about the new post.
Common Use Cases
Automated Announcements
Post automated announcements to your network:
async function postAnnouncement(networkId, spaceId, message, apiToken) {
const response = await fetch(
`https://api.mn.co/admin/v1/networks/${networkId}/posts?notify=true`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${apiToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
body: message,
space_id: spaceId
})
}
);
if (!response.ok) {
throw new Error(`Failed to create post: ${response.statusText}`);
}
return await response.json();
}
// Usage
await postAnnouncement(
NETWORK_ID,
ANNOUNCEMENTS_SPACE_ID,
'🎉 New feature launched! Check out our latest update.',
API_TOKEN
);
Content Moderation
Monitor recent posts for moderation:
async function getRecentPosts(networkId, hours, apiToken) {
const response = await fetch(
`https://api.mn.co/admin/v1/networks/${networkId}/posts`,
{ headers: { 'Authorization': `Bearer ${apiToken}` } }
);
const posts = await response.json();
const cutoffTime = Date.now() - (hours * 60 * 60 * 1000);
return posts.items.filter(post => {
const postTime = new Date(post.created_at).getTime();
return postTime >= cutoffTime;
});
}
// Get posts from last 24 hours
const recentPosts = await getRecentPosts(NETWORK_ID, 24, API_TOKEN);
Engagement Analytics
Track post engagement metrics:
async function getPostEngagement(networkId, apiToken) {
const response = await fetch(
`https://api.mn.co/admin/v1/networks/${networkId}/posts`,
{ headers: { 'Authorization': `Bearer ${apiToken}` } }
);
const posts = await response.json();
return posts.items.map(post => ({
id: post.id,
body: post.body.substring(0, 50) + '...',
comments: post.comments_count || 0,
reactions: post.reactions_count || 0,
engagement: (post.comments_count || 0) + (post.reactions_count || 0),
created: post.created_at
})).sort((a, b) => b.engagement - a.engagement);
}
Scheduled Posts
Create a simple scheduled posting system:
async function schedulePost(networkId, spaceId, content, scheduleTime, apiToken) {
const delay = new Date(scheduleTime).getTime() - Date.now();
if (delay < 0) {
throw new Error('Schedule time must be in the future');
}
setTimeout(async () => {
await fetch(
`https://api.mn.co/admin/v1/networks/${networkId}/posts?notify=true`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${apiToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
body: content,
space_id: spaceId
})
}
);
}, delay);
console.log(`Post scheduled for ${scheduleTime}`);
}
// Schedule a post for tomorrow at 9 AM
const tomorrow9AM = new Date();
tomorrow9AM.setDate(tomorrow9AM.getDate() + 1);
tomorrow9AM.setHours(9, 0, 0, 0);
await schedulePost(
NETWORK_ID,
SPACE_ID,
'Good morning! Here\'s your daily motivation.',
tomorrow9AM,
API_TOKEN
);
Content Export
Export all posts for backup or analysis:
async function exportAllPosts(networkId, apiToken) {
let allPosts = [];
let page = 1;
let hasMore = true;
while (hasMore) {
const response = await fetch(
`https://api.mn.co/admin/v1/networks/${networkId}/posts?page=${page}`,
{ headers: { 'Authorization': `Bearer ${apiToken}` } }
);
const data = await response.json();
allPosts = allPosts.concat(data.items);
hasMore = data.links?.next != null;
page++;
// Rate limiting
await new Promise(resolve => setTimeout(resolve, 100));
}
return allPosts;
}
Posts can include various types of media:
Images
Posts can contain embedded images. When creating posts with images, you’ll need to upload the image first and then reference it in the post body.
Videos
Videos can be embedded in posts, either through direct uploads or links to platforms like YouTube or Vimeo.
Links
URLs in post content are automatically detected and can be previewed with link cards.
Best Practices
- Use Pagination - Always paginate when fetching multiple posts
- Rate Limiting - Be mindful of rate limits when creating multiple posts
- Notify Sparingly - Only use
notify=true for important announcements
- Validate Content - Check post content before creating to avoid errors
- Handle Errors - Implement proper error handling for failed post creation
- Cache Post Data - Store frequently accessed posts locally
- Monitor Engagement - Track comments and reactions for content insights
Next Steps