Social Media Manager

How to use this API

1. Create a new agency

Creates a new agency, linked to its source (e.g. casagest24).

POST /api/agency/signup/

Sample payload

{
  "agency_id": "1",
  "source": "casagest24" | "peracquisire" | "casacheck24"
}

Sample request

curl -X POST http://localhost:3000/api/agency/signup/ -H "Content-Type: application/json" -H "Authorization: Bearer 1n513m3" -d '{
  "agency_id": "5",
  "name": "La Vera Agenzia",
  "email": "marco@gruppoinsieme.it",
  "source": "casagest24"
}'

This will create a record in the `users` table

2. Request a valid JWT

Request a valid JWT token that can be used for subsequent client-side requests.

/verify

curl -X POST http://localhost:3000/verify -H "Content-Type: application/json" -H "Authorization: Bearer 1n513m3" -d '{
  "userId": "1"
}'

3. Connect Facebook account

Redirects the user to the Facebook authorization page to connect their Facebook account.

GET /fb/auth/connect

curl -X GET -H "Authorization: Bearer your-JWT-here" http://localhost:3000/fb/auth/connect

This will create a record in the `connections` table

4.Obtain the user's profile data

Use the token (see #3) saved in the `connections` table to find the eligible social media accounts for this user

POST /fb/connect/profile

curl -X POST -H "Authorization: Bearer your-JWT-here" http://localhost:3000/fb/connect/profile

This will create a record in the `accounts` table

5. Get the user's connected accounts

POST /user/accounts

curl -X POST -H "Authorization: Bearer your-JWT-here" http://localhost:3000/user/accounts

This will create a record in the `accounts` table

6. Get the user's posts

Retrieve all posts associated with the user's account.

GET /user/posts

curl -X GET -H "Authorization: Bearer your-JWT-here" http://localhost:3000/user/posts

This will return all posts associated with the authenticated user.