Skip to content

Backend API

Pierre Marguerie edited this page Nov 2, 2025 · 21 revisions

Home

Backend API

This page describes the different endpoint of the app to communicate with the backend.

About.json

route: GET {BACKEND_URL}/about.json

response:

{
  "client": {
    "host": "10.101.53.35"
  },
  "server": {
    "current_time": 1531680780,
    "services": [
      {
        "name": "facebook",
        "actions": [
          {
            "name": "new_message_in_group",
            "description": "A new message is posted in the group"
          },
          {
            "name": "new_message_inbox",
            "description": "A new private message is received by the user"
          },
          {
            "name": "new_like",
            "description": "The user gains a like from one of their messages"
          }
        ],
        "reactions": [
          {
            "name": "like_message",
            "description": "The user likes a message"
          }
        ]
      }
    ]
  }
}

Oauth Login


Register

route: POST {BACKEND_URL}/user/register/:service

Creates a new user with the service infos.

expected body:

{
    "code": "<OAUTH_CODE>"
    "front": true // true if from frontend, false if from mobile
}

possible responses:

201: Created

{
 "uuid": "<UUID>",
 "nickname": "SERVICE_NAME",
 "username": "SERVICE_USERNAME",
 "email": "<SERVICE_EMAIL>",
 "profilePicture": "<PROFILE_PICTURE>",
 "oauth_uuids": [
	   {
	     "service_name": "<NAME_OF_THE_SERVICE>",
	     "token_uuid": "<TOKEN_UUID>"
	   }
   ]
}

400: Bad request

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "<THE_ERROR>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Login

route: POST {BACKEND_URL}/user/login/:service

Connects to a user previously connected with the service.

expected body:

{
    "code": "<OAUTH_CODE>"
    "front": true // true if from frontend, false if from mobile
}

possible responses:

201: Created

{
  "uuid": "<UUID>",
  "access_token": "<ACCESS_TOKEN>",
  "refresh_token": "<REFRESH_TOKEN>"
}

400: Bad request

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "<THE_ERROR>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Login


Register

route: POST {BACKEND_URL}/user/register

Creates a user.

Expected body:

{
  "email": "email@example.com",
  "password": "MyStrongPa$$w0rd",
  "nickname": "John",
  "username": "John_Doe"
}

Possible responses:

201: Created

{
  "uuid": "<UUID>",
  "email": "jane@example.com",
  "username": "jane_doe",
  "nickname": "Jane",
  "profilePicture": ""
}

400: Bad request

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": [
      "password is not strong enough",
      "password should not be empty"
   ],
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Login

route: POST {BACKEND_URL}/user/login

Log into an existing account.

Expected body:

{
  "email": "john.doe@email.com",
  "password": "Password"
}

Possible responses:

201: Created

{
  "uuid": "<UUID>",
  "access_token": "<JWT>",
  "refresh_token": "<JWT>"
}

401: Unauthorized

{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Invalid credentials",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

400: Bad request

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": [
      "password should not be empty"
   ],
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Refresh

route: POST {BASE_URL}/user/refresh

Exchange a valid refresh token for a new access token.

Expected body:

{
  "refresh_token": "<JWT>"
}

Possible responses:

201: Created

{
  "access_token": "<JWT>"
}

400: Bad request

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": [
      "string must be a jwt string"
   ],
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Log out

route: POST {BASE_URL}/user/logout

Log out.

Expected body:

{
  "uuid": "<UUID>"
}

Possible responses:

201: Created

{
  "message": "Logged out successfully"
}

400: Bad Request

{
  "message": "Could not log out"
}

404: Not found

{
  "statusCode": 404,
  "error": "Not found",
  "message": "no user with uuid <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Users


Get all users

route: GET {BASE_URL}/users

Retrieve all users in the system.

Possible responses:

200: OK

[
  {
    "uuid": "<UUID>",
    "email": "john@example.com",
    "username": "john_doe",
    "nickname": "John",
    "profilePicture": "",
    "refreshToken": "<HASHED_REFRESH>"
    "oauth_uuids": [
        {
            "service_name": "twitch",
            "token_uuid": "<TOKEN_UUID>"
        }
    ]
  }
]

Get a single user with uuid

route: GET {BASE_URL}/users/:uuid

Retrieve a single user by their UUID.

Possible responses:

200: OK

{
  "uuid": "<UUID>",
  "email": "john@example.com",
  "username": "john_doe",
  "nickname": "John",
  "profilePicture": "",
  "refreshToken": "<HASHED_REFRESH>"
  "oauth_uuids": [
      {
          "service_name": "twitch",
          "token_uuid": "<TOKEN_UUID>"
      }
   ]
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No user found with uuid <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Get all AREAs of a user

route: GET {BASE_URL}/users/:uuid/areas

Retrieve all areas associated with a user.

Possible responses:

200: OK

[
  {
	"trigger_uuid": "<TRIGGER_UUID>",
	"response_uuid": "<RESPONSE_UUID>",
	"user_uuid": "<USER_UUID>",
	"name": "Area testing",
	"description": "This is an area for tests purposes only",
	"enabled": true,
	"disabled_until": null,
	"history": [],
	"uuid": "<UUID>",
	"createdAt": "<TIMESTAMP>",
	"updatedAt": "<TIMESTAMP>"
  }
]

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No areas found for user <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Get an AREA by UUID

route: GET {BASE_URL}/users/:uuid/areas/:area_uuid

Retrieve a specific area by its UUID for a given user.

Possible responses:

200: OK

{
	"trigger_uuid": "<TRIGGER_UUID>",
	"response_uuid": "<RESPONSE_UUID>",
	"user_uuid": "<USER_UUID>",
	"name": "Area testing",
	"description": "This is an area for tests purposes only",
	"enabled": true,
	"disabled_until": null,
	"history": [],
	"uuid": "<UUID>",
	"createdAt": "<TIMESTAMP>",
	"updatedAt": "<TIMESTAMP>"
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No area found with uuid <AREA_UUID> for user <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Get an AREA's trigger

route: GET {BASE_URL}/users/:uuid/areas/:area_uuid/trigger

Retrieve the trigger configuration for a specific area of a user.

Possible responses:

200: OK

{
    "uuid": "<TRIGGER_UUID>",
    "service_name": "Github",
    "name": "Push on repository",
    "description": "Triggers when a push is made on a repository",
    "oauth_token": "<TOKEN>",
    "meta": {},
    "trigger_type": "webhook",
    "input": {
        "owner": "<REPO_OWNER>",
        "repo": "<REPO_NAME>",
        "event": "push"
    }
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No triggers found for area <AREA_UUID> of user <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Disable an area

route: GET {BASE_URL}/users/:uuid/areas/:area_uuid/disable

Disables an area.

Possible responses:

200: OK

{
	"trigger_uuid": "<TRIGGER_UUID>",
	"response_uuid": "<RESPONSE_UUID>",
	"user_uuid": "<USER_UUID>",
	"name": "Area testing",
	"description": "This is an area for tests purposes only",
	"enabled": <UPDATED_STATE>,
	"disabled_until": null,
	"history": [],
	"uuid": "<UUID>",
	"createdAt": "<TIMESTAMP>",
	"updatedAt": "<TIMESTAMP>"
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No area found with uuid <AREA_UUID> for user <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Enable an area

route: GET {BASE_URL}/users/:uuid/areas/:area_uuid/enable

Enables an area.

Possible responses:

200: OK

{
	"trigger_uuid": "<TRIGGER_UUID>",
	"response_uuid": "<RESPONSE_UUID>",
	"user_uuid": "<USER_UUID>",
	"name": "Area testing",
	"description": "This is an area for tests purposes only",
	"enabled": <UPDATED_STATE>,
	"disabled_until": null,
	"history": [],
	"uuid": "<UUID>",
	"createdAt": "<TIMESTAMP>",
	"updatedAt": "<TIMESTAMP>"
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No area found with uuid <AREA_UUID> for user <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Get an AREA's response

route: GET {BASE_URL}/users/:uuid/areas/:area_uuid/response

Retrieve the response configuration for a specific area of a user.

Possible responses:

200: OK

{
    "uuid": "<RESPONSE_UUID>",
    "service_name": "Discord",
    "name": "Send message",
    "description": "Sends a message to a specific channel",
    "oauth_token": "<TOKEN>",
    "resource_ids": {
        "channel_id": "<CHANNEL_ID>"
    },
    "payload": "A new event has been triggered"
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No responses found for area <AREA_UUID> of user <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Get a user by its refresh token

route: GET {BASE_URL}/users/getuser/:refreshtoken

Retrieve user information based on a valid refresh token.

Possible responses:

200: OK

{
  "uuid": "<UUID>",
  "email": "john@example.com",
  "username": "john_doe",
  "nickname": "John",
  "profilePicture": ""
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No user found for the provided refresh token",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Delete User

route: DELETE {BASE_URL}/users/:uuid

Delete a user by their UUID.

Possible responses:

200: OK

{
  "message": "User deleted successfully"
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No user found with uuid <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Modify User

route: PATCH {BASE_URL}/users/uuid

expected_body:

{
    
  "nickname": "new Nickname",
  "username": "new Username",
  "profilePicture": "New pfp"  
}

response: 200: OK

Oauth


GitHub OAuth

route: POST {BASE_URL}/oauth/github

Authenticate a user using GitHub OAuth and exchange the OAuth code for an access token.

Expected body:

{
  "code": "<GITHUB_OAUTH_CODE>",
  "uuid": "<USER_UUID>"
  "front": true // true if from frontend, false if from mobile
}

Possible responses:

201: OK

{
  "uuid": "<OAUTH_UUID>",
  "service_name": "Github",
  "token": "<TOKEN>",
  "refresh_token": "<TOKEN>",
  "token_type": "<TOKEN_TYPE>",
  "expires_at": "<Date>"
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No user found with uuid <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Actions


Get all Actions

route: GET {BASE_URL}/actions

Important: One of the parameter can mention a field content. If a parameter is mentionning this, it means that when creating the associated trigger, in the input field, the element input.name must be the same as the value in the content field.

Retrieve all actions available in the system.

Possible responses:

200: OK

[
  {
  	"uuid": "<UUID>"
  	"name": "New message",
  	"service_name": "Discord",
  	"description": "triggers when a new message is posted in the specified server",
  	"parameters": [
  		{
  			"name": "guild_id",
  			"type": "string",
  			"description": "The id of the server to watch"
  		},
  		{
  			"name": "channel_id",
  			"type": "string",
  			"description": "The id of the channel to watch (optional)"
  		}
  	],
  	"trigger_types": [
  		"webhook"
  	],
  	"createdAt": "2025-10-30T22:23:28.354Z",
  	"updatedAt": "2025-10-31T16:16:45.316Z",
  },
]

Get Action by UUID

route: GET {BASE_URL}/actions/:uuid

Retrieve a single action by its UUID.

Possible responses:

200: OK

{
  "uuid": "<UUID>"
  "name": "Push on repository",
  "service_name": "Github",
  "description": "trigger when a push is made on the given repository",
  "parameters": [
    {
      "name": "owner",
      "type": "string",
      "description": "The owner of the repository"
    },
    {
      "name": "repo",
      "type": "string",
      "description": "The full repository name (e.g., user/repo)"
    },
    {
      "name": "event",
      "content": "push"
    }
  ],
  "trigger_types": [
    "webhook"
  ],
  "createdAt": "2025-10-30T22:23:28.359Z",
  "updatedAt": "2025-10-31T16:16:45.320Z",
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No action found with uuid <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Reactions


Get all Reactions

route: GET {BASE_URL}/reactions

Retrieve all reactions available in the system.

important: If a reaction mentions the field requires_payload, it means that when creating the associated response the fields payload is required.

Possible responses:

200: OK

[
	{
	  "name": "Send message",
	  "service_name": "Discord",
	  "description": "Send a message to the specified channel",
	  "parameters": [
	    {
	      "name": "channel_id",
	      "type": "string",
	      "description": "The id of the discord channel to send a message to."
	    }
	  ],
	  "uuid": "c6ddc606-c1cc-4001-88e3-beb4bbafdd8c",
	  "requires_payload": true
	}
]

Get Reaction by UUID

route: GET {BASE_URL}/reactions/:uuid

Retrieve a single reaction by its UUID.

Possible responses:

200: OK

{
  "name": "Send message",
  "service_name": "Discord",
  "description": "Send a message to the specified channel",
  "parameters": [
	{
	  "name": "channel_id",
	  "type": "string",
	  "description": "The id of the discord channel to send a message to."
	}
  ],
  "uuid": "<UUID>",
  "requires_payload": true
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No reaction found with uuid <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Services


Get all Services

route: GET {BASE_URL}/services

response: 200: OK

[
	{
	  "name": "Discord",
	  "actions": [
	    {
	      "uuid": "<UUID>",
	      "name": "New message",
	      "description": "triggers when a new message is posted in the specified server",
	      "parameters": [
	        {
	          "name": "guild_id",
	          "type": "string",
	          "description": "The id of the server to watch"
	        },
	        {
	          "name": "channel_id",
	          "type": "string",
	          "description": "The id of the channel to watch (optional)"
	        }
	      ],
	      "trigger_types": [
	        "webhook"
	      ]
	    },
	    {
	      "uuid": "<UUID>",
	      "name": "New reaction",
	      "parameters": [
	        {
	          "name": "guild_id",
	          "type": "string",
	          "description": "The id of the Server to watch"
	        },
	        {
	          "name": "channel_id",
	          "type": "string",
	          "description": "The id of the channel to watch (optional)"
	        },
	        {
	          "name": "message_id",
	          "type": "string",
	          "description": "The id of the message to watch(optional)"
	        }
	      ],
	      "description": "triggers when a new reaction is added on a server",
	      "trigger_types": [
	        "webhook"
	      ]
	    }
	  ],
	  "endpoints": {
	    "app": "https://discord.com/oauth2/authorize?client_id=1424797683578834994"
	  },
	  "icon": "<BASE_64_ICON>",
	  "reactions": [
	    {
	      "uuid": "<UUID>",
	      "name": "Send message",
	      "requires_payload": true,
	      "parameters": [
	        {
	          "name": "channel_id",
	          "type": "string",
	          "description": "The id of the discord channel to send a message to."
	        }
	      ],
	      "description": "Send a message to the specified channel"
	    },
	    {
	      "uuid": "<UUID>",
	      "name": "Add role",
	      "requires_payload": null,
	      "parameters": [
	        {
	          "name": "guild_id",
	          "type": "string",
	          "description": "The id of the Server to watch"
	        },
	        {
	          "name": "user_id",
	          "type": "string",
	          "description": "The id of the user to add the role to"
	        },
	        {
	          "name": "role_id",
	          "type": "string",
	          "description": "The id of the role to add"
	        }
	      ],
	      "description": "Adds the specified role to the specified user"
	    }
	  ],
	  "uuid": "<UUID>"
	}
]

Get a Services by its uuid

route: GET {BASE_URL}/services/:uuid

possible responses: 200: OK

{
  "name": "Discord",
  "actions": [
	{
	  "uuid": "<UUID>",
	  "name": "New message",
	  "description": "triggers when a new message is posted in the specified server",
	  "parameters": [
		{
		  "name": "guild_id",
		  "type": "string",
		  "description": "The id of the server to watch"
		},
		{
		  "name": "channel_id",
		  "type": "string",
		  "description": "The id of the channel to watch (optional)"
		}
	  ],
	  "trigger_types": [
		"webhook"
	  ]
	},
	{
	  "uuid": "<UUID>",
	  "name": "New reaction",
	  "parameters": [
		{
		  "name": "guild_id",
		  "type": "string",
		  "description": "The id of the Server to watch"
		},
		{
		  "name": "channel_id",
		  "type": "string",
		  "description": "The id of the channel to watch (optional)"
		},
		{
		  "name": "message_id",
		  "type": "string",
		  "description": "The id of the message to watch(optional)"
		}
	  ],
	  "description": "triggers when a new reaction is added on a server",
	  "trigger_types": [
		"webhook"
	  ]
	}
  ],
  "endpoints": {
	"app": "https://discord.com/oauth2/authorize?client_id=1424797683578834994"
  },
  "icon": "<BASE_64_ICON>",
  "reactions": [
	{
	  "uuid": "<UUID>",
	  "name": "Send message",
	  "requires_payload": true,
	  "parameters": [
		{
		  "name": "channel_id",
		  "type": "string",
		  "description": "The id of the discord channel to send a message to."
		}
	  ],
	  "description": "Send a message to the specified channel"
	},
	{
	  "uuid": "<UUID>",
	  "name": "Add role",
	  "requires_payload": null,
	  "parameters": [
		{
		  "name": "guild_id",
		  "type": "string",
		  "description": "The id of the Server to watch"
		},
		{
		  "name": "user_id",
		  "type": "string",
		  "description": "The id of the user to add the role to"
		},
		{
		  "name": "role_id",
		  "type": "string",
		  "description": "The id of the role to add"
		}
	  ],
	  "description": "Adds the specified role to the specified user"
	}
  ],
  "uuid": "<UUID>"
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No service found with uuid <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Areas


Get All Areas

route: GET {BASE_URL}/areas

Retrieve all areas in the system.

Possible responses:

200: OK

[
  {
    "uuid": "<UUID>",
    "trigger_uuid": "<TRIGGER_UUID>",
    "response_uuid": "<RESPONSE_UUID>",
    "user_uuid": "<USER_UUID>",
    "name": "new pull request",
    "description": "Sends a discord message when a new pull request is opened",
    "enabled": true,
    "disabled_until": null,
    "history": [
      {
        "timestamp": "2025-10-28T10:33:50.888Z",
        "status": "ok"
      },
      {
        "timestamp": "2025-10-28T10:33:50.888Z",
        "status": "ko",
        "info": "<ERROR_MESSAGE>"
      }
    ],
    "createdAt": "2025-10-28T10:33:50.888Z",
    "updatedAt": "2025-10-28T10:33:50.888Z"
  }
]

Get Area by UUID

route: GET {BASE_URL}/areas/:uuid

Retrieve a single area by its UUID.

Possible responses:

200: OK

{
  "uuid": "<UUID>",
  "trigger_uuid": "<TRIGGER_UUID>",
  "response_uuid": "<RESPONSE_UUID>",
  "user_uuid": "<USER_UUID>",
  "name": "Pull request to discord",
  "description": "Writes a message in discord when a new pull request is opened",
  "enabled": true,
  "disabled_until": null,
  "history": [
    {
      "timestamp": "2025-10-28T10:33:50.888Z",
      "status": "ok"
    }
  ],
  "createdAt": "2025-10-28T10:33:50.888Z",
  "updatedAt": "2025-10-28T10:33:50.888Z"
}

404: Not Found

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "No area found with uuid <UUID>",
  "timestamp": "2025-10-28T10:33:50.888Z"
}

Create a new AREA

route: POST {BASE_URL}/areas/

Create a new AREA.

expected body:

{
	"trigger": {
		"service_name": "Github",
		"name": "Pull request",
		"description": "Triggers when a pull request is opened",
	    "input": {
				"owner": "<REPOSITORY_OWNER>",
				"repo": "<REPOSITORY_NAME>",
				"event": "pull_request"
		},
	    "trigger_type": "webhook"
	},
	"response": {
          "service_name": "Discord",
          "name": "Send message",
          "resource_ids": {
              "channel_id": "<CHANNEL_ID>"
          },
          "payload": "<MESSAGE>"
	},
	"user_uuid": "<USER_UUID>",
	"name": "Area testing",
	"description": "This is an area for tests purposes only",
	"enabled": "true"
}

Possible responses: 201: Created

{
  "uuid": "<UUID>",
  "trigger_uuid": "<TRIGGER_UUID>",
  "response_uuid": "<RESPONSE_UUID>",
  "user_uuid": "<USER_UUID>",
  "name": "Area Testing",
  "description": "This is an area for tests purposes only",
  "enabled": true,
  "disabled_until": null,
  "history": [],
  "createdAt": "2025-10-28T10:33:50.888Z",
  "updatedAt": "2025-10-28T10:33:50.888Z"
}

400: Bad request

{
    "statusCode": "400",
    "error": "Bad Request",
    "message": "<ERROR_DETAILS>",
    "timestamp": "<DATE>"
}