Project Routes
routes.project_routes.add_project()
Adds a Voiceflow assistant’s metadata to the database after retrieving and encrypting necessary data.
URL:
- POST /add_project
- Parameters:
- version_id (str) – The version ID of the Voiceflow assistant to add.
- token (str) – The API key of the Voiceflow assistant, which will be encrypted and stored.
- Returns: A message indicating whether the assistant was added successfully, along with the assistant Name, Id, and Created properties, or an error message.
- Return type: JSON response (dict)
Status Codes:
- 200 OK: Project added successfully.
- 400 Bad Request: Invalid request payload or an error occurred.
- 401 Unauthorized: User is not allowed to add assistants.
Note for use: The assistant must be previously configured in Voiceflow Studio. The version_id is used for specific Voiceflow endpoints. This endpoint requires an Admin role to execute.
routes.project_routes.delete_project()
Deletes a specified Voiceflow assistant from the API’s internal database but does not affect Voiceflow’s records.
URL:
- POST /delete_project
- Parameters:
- project_name (str) – The name of the Voiceflow assistant to delete.
- Returns: A message indicating whether the assistant was deleted successfully.
- Return type: JSON response (dict)
Status Codes:
- 200 OK: Project deleted successfully.
- 400 Bad Request: Invalid request payload or an error occurred.
Access Control:
- Requires the Admin role for deleting assistants.
routes.project_routes.get_projects()
Retrieves a list of all the Voiceflow assistants that the user has access to from the database.
URL:
- GET /get_projects
- Returns: A list of assistants or an error message.
- Return type: JSON response (dict)
Status Codes:
- 200 OK: List of projects retrieved successfully.
- 400 Bad Request: Assistants could not be retrieved.
- 401 Unauthorized: User is not authenticated.
- 404 Not Found: No assistants found.
Notes
- User authentication is verified using the get_user_info function.
- The function checks if the user is an admin using the check_admin function.
routes.project_routes.set_project()
Sets up a session for a specified Voiceflow assistant if the user is authorized, and stores relevant session data in a cookie.
URL:
- POST /set_project
- Parameters:
- project_id (str) – The ID of the Voiceflow assistant for which the session is to be set up.
- Returns: A message indicating the success of the setup, along with assistant details such as Name, Id, and Created, or an error message.
- Return type: JSON response (dict)
Status Codes:
- 200 OK: Project set successfully.
- 400 Bad Request: Invalid request payload or an error occurred.
- 401 Unauthorized: User is not allowed to access the specified Voiceflow assistant.