A python wrapper for the Fancy Hands API
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
fancyhands allow users to specify a host. bump the version. Apr 3, 2017
.gitignore readme stuff. Aug 15, 2014
LICENCE.txt readme stuff. Aug 15, 2014
README.md Update README.md May 14, 2015
realtime-example.py added realtime apis. Jul 29, 2015
setup.py allow users to specify a host. bump the version. Apr 3, 2017



Python library for the Fancy Hands API. Full documentation for the API lives on github.





Just copy the fancyhands-python/fancyhands directory to your project or:

pip install fancyhands


git clone https://github.com/fancyhands/fancyhands-python
cd fancyhands-python
python setup.py install


Dealing with 'custom' requests
from fancyhands import FancyhandsClient

api_key = 'your_api_key'
secret = 'your_api_secret'

client = FancyhandsClient(api_key, secret)

# Get last 20 requests
requests = client.custom_get()

# Create a new custom request
from datetime import datetime, timedelta

title = 'Call Nicholas'
description = 'Tell him to make me some toast.'
bid = 4.0
expiration_date = datetime.now() + timedelta(1)

custom_fields = []
custom_field = {
	'description':'When will my toast be done?',

request = client.custom_create(title, description, bid, expiration_date, custom_fields)

# Create a new standard request
title = "Call Ted"
description = "Tell him his toast is ready"

request = client.standard_create(title=title, description=description, bid=bid, expiration_date=expiration_date)

# Get a standard request
request = client.standard_get(key=request['key'])

# Message a standard request
client.standard_message(key=request['key'], message="Is the toast done yet")

# Create a new call request
# Visit: https://www.fancyhands.com/api/explorer/script/builder#/start
# Create a script for the assistant and paste it into your code
import json
conversation = json.dumps({"id":"sample_conversation","data":{},"name":"Sample Conversation","version":1.1,"scripts":[{"id":"start","steps":[{"name":"hello","type":"logic_control","note":"","prompt":"Hello, my name is $assistant_name","options":[{"name":"Continue","result":"sample_script"}]}]},{"id":"sample_script","steps":[{"name":"name","prompt":"What is your name?","type":"text","options":[]},{"name":"quest","prompt":"What is your quest?","type":"textarea","options":[]},{"type":"logic_control","name":"favorite_color","note":"","options":[{"name":"Red","result":"finish"},{"name":"Yellooooooooooooow","result":"finish","new_script":""},{"name":"Blue","result":"transfer"}],"prompt":"What is your favorite color?"}]},{"id":"finish","steps":[{"type":"logic_control","name":"goodbye","note":"","prompt":"Thank you $sample_script.name. I wish you good luck with $sample_script.quest.","options":[]}]},{"id":"transfer","steps":[{"type":"logic_control","name":"transfer","note":"","prompt":"$sample_script.favorite_color!!!? I wasn't expecting that... Please hold while I transfer you to my manager.","options":[{"name":"Transfer Call","result":"-- Transfer Call --"}]}],"transfer_number":"5555555555"}]})

# Add a valid US phone number
phone = '5555555555'

# Should we retry the call? This is not required
retry = True

# Retry every two hours
retry_delay = 60 * 60 * 2

# How many times to retry the call
retry_limit = 3

request = client.outgoing_create(phone=phone, conversation=conversation, retry=retry, retry_delay=retry_delay, retry_limit=retry_limit)