Skip to content

daiangan/voiceflow-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voiceflow Python Package

This is an unofficial Python package for an easy use of the Voiceflow API.

Basic usage

In your virtual environment:

pip install voiceflow

Then in your Python code:

import os
from voiceflow import Voiceflow

vf = Voiceflow(
    api_key=os.getenv('VOICEFLOW_API_KEY'),
    user_id='abc123'
)

# Launch the agent
vf_response = vf.interact.launch()

# Send a simple text input
vf_response = vf.interact.text(user_input='hello')

Pass the version of your Voiceflow project to contact. It can be development (default) or production.

vf = Voiceflow(
    api_key=os.getenv('VOICEFLOW_API_KEY'),
    user_id='abc123',
    version_id='production'
)

You can also call launch() or text() with your custom config:

vf_response = vf.interact.launch(config={'stripSSML': False})

Default config values:

{
    'tts': False,
    'stripSSML': True,
    'stopAll': True,
    'stopTypes': [],
    'excludeTypes': [
        'block',
        'debug',
        'flow',
    ]
}

User State:

# Fetch the user's current state
vf_response = vf.user_state.fetch()

# Delete all state and session data for user.
vf_response = vf.user_state.delete()

# NotImplemented:
# Update the user's current state.

Variables:

variables = {
    'test1': 'one',
    'test2': 2,
}
vf_response = vf.variables.update(variables=variables)


About this project

This project is created and maintained by:
Daian Gan
Github: daiangan
E-mail: daian@ganmedia.com
Website: https://daiangan.com

About

Voiceflow Python Package.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages