Docs
Routes
Voiceflow.routes

Voiceflow Routes

routes.voiceflow_routes.delete()

Deletes the user’s current state in Voiceflow.

  • URL: DELETE /voiceflow/delete_state
  • Returns: A confirmation of deletion or an error message.
  • Return type: JSON response (dict)
  • Status Codes:
    • 200 OK: State deleted successfully.
    • 400 Bad Request: No user cookie set or an error occurred.

routes.voiceflow_routes.fetch()

Fetches the current state of the user from Voiceflow, detailing their position in the conversation flow.

  • URL: POST /voiceflow/fetch_state
  • Returns: The current Voiceflow state of the user or an error message.
  • Return type: JSON response (dict)
  • Status Codes:
    • 200 OK: State retrieved successfully.
    • 400 Bad Request: No user cookie set or an error occurred.

routes.voiceflow_routes.interact()

Facilitates interaction with a Voiceflow assistant using user-provided inputs such as button clicks or text messages.

  • URL: POST /voiceflow/interact
  • Parameters:
    • btn (object) – The button clicked by the user, if applicable.
    • response (str) – The text message sent by the user to the assistant.
  • Returns: The response from the Voiceflow assistant or an error message.
  • Return type: JSON response (dict)
  • Status Codes:
    • 200 OK: Interaction completed successfully.
    • 400 Bad Request: Invalid request payload or an error occurred.
    • 401 Unauthorized: Assistant or User session could not be resolved.

routes.voiceflow_routes.launch()

Launches a Voiceflow assistant to initialize a conversation. Validates user and assistant sessions before proceeding to create a new chat session.

  • URL: POST /voiceflow/launch
  • Returns: The response from the Voiceflow assistant or an error message.
  • Return type: JSON response (dict)
  • Status Codes:
    • 200 OK: Assistant launched successfully.
    • 400 Bad Request: Invalid request payload or an error occurred.
  • Raises:
    • ValueError – If no user or assistant data is present, indicating a failure to launch.

routes.voiceflow_routes.transcript()

Creates a transcript of a Voiceflow conversation, storing details in both Voiceflow and the local database.

  • URL: PUT /voiceflow/create-transcript
  • Parameters:
    • device (str) – The device on which the conversation occurred.
    • oss (str) – The operating system of the device.
    • browser (str) – The browser used during the conversation.
  • Returns: Confirmation of transcript creation or an error message.
  • Return type: JSON response (dict)
  • Status Codes:
    • 200 OK: Transcript created successfully.
    • 400 Bad Request: Invalid request payload or an error occurred.

routes.voiceflow_routes.update_variable()

Updates a variable within the Voiceflow assistant’s session context based on user input.

  • URL: PATCH /voiceflow/update_variable
  • Parameters:
    • key (str) – The name of the variable to update.
    • value (str) – The new value for the variable.
  • Returns: Confirmation of the variable update or an error message.
  • Return type: JSON response (dict)
  • Status Codes:
    • 200 OK: Variable updated successfully.
    • 400 Bad Request: Invalid request payload or an error occurred.