API Examples
All endpoints are Firebase HTTPS Functions. Unless noted, include header x-api-key: <API_KEY>.
Base URL examples:
- Local emulator:
http://localhost:5001/<project-id>/us-central1/<functionName> - Production:
https://us-central1-<project-id>.cloudfunctions.net/<functionName>
Create Post
curl -X POST \
-H "Content-Type: application/json" \
-H "x-api-key: $API_KEY" \
"https://us-central1-<project-id>.cloudfunctions.net/createPost" \
-d '{
"businessId": "BUS123",
"participantId": "USER456",
"title": "My Post",
"content": "Hello world",
"linkedInPost": "...",
"linkedInPostId": "activity_urn_123",
"metadata": {"source": "generator"}
}'
Get Participants
curl -X POST \
-H "Content-Type: application/json" \
-H "x-api-key: $API_KEY" \
"https://us-central1-<project-id>.cloudfunctions.net/getParticipants" \
-d '{"businessId": "BUS123"}'
Company LinkedIn Posts
Create/Upsert:
curl -X POST \
-H "Content-Type: application/json" \
-H "x-api-key: $API_KEY" \
"https://us-central1-<project-id>.cloudfunctions.net/createCompanyLinkedInPost" \
-d '{
"businessId": "BUS123",
"documentId": "activity_urn_123",
"content": "...",
"url": "https://linkedin.com/feed/update/urn:li:activity:...",
"used": false,
"exclude": false
}'
Get by ID:
curl -X POST \
-H "Content-Type: application/json" \
-H "x-api-key: $API_KEY" \
"https://us-central1-<project-id>.cloudfunctions.net/getLinkedInPost" \
-d '{"businessId": "BUS123", "documentId": "activity_urn_123"}'
Get one unused:
curl -X POST \
-H "Content-Type: application/json" \
-H "x-api-key: $API_KEY" \
"https://us-central1-<project-id>.cloudfunctions.net/getUnusedLinkedInPost" \
-d '{"businessId": "BUS123"}'
Mark used:
curl -X POST \
-H "Content-Type: application/json" \
-H "x-api-key: $API_KEY" \
"https://us-central1-<project-id>.cloudfunctions.net/updateLinkedInPost" \
-d '{"businessId": "BUS123", "documentId": "activity_urn_123", "used": true}'
Get Company By ID
curl -X POST \
-H "Content-Type: application/json" \
-H "x-api-key: $API_KEY" \
"https://us-central1-<project-id>.cloudfunctions.net/getCompanyById" \
-d '{"businessId": "BUS123"}'
Update User Persona
curl -X POST \
-H "Content-Type: application/json" \
"https://us-central1-<project-id>.cloudfunctions.net/updateUserPersona" \
-d '{
"parentDocId": "BUS123",
"subDocId": "USER456",
"updates": {
"role": "coach",
"themes": [{"type": "product-updates", "description": "new desc"}]
}
}'
Next.js Webhook (n8n Forwarder)
curl -X POST \
-H "Content-Type: application/json" \
"https://<your-host>/api/linkedin-webhook" \
-d '{
"uid": "USER456",
"businessId": "BUS123",
"linkedinUrl": "https://linkedin.com/in/handle",
"metadataName": "profile-ingest"
}'