Alexa Voice Monkey Skill can run routines w/an API & speak

Posted on
Wed Mar 30, 2022 12:59 am
anyone offline
User avatar
Posts: 125
Joined: Apr 03, 2011
Location: Norfolk, VA

Alexa Voice Monkey Skill can run routines w/an API & speak

There is pretty good write up https://towardsdatascience.com/monkeying-around-with-alexa-routines-3f3f95795922 which explains how someone used a Raspberry Pi to invoke Alexa Routines with Python code by using a Skill called Voice Monkey.

The skill allows you to run Alexa Routines by creating Virtual Triggers/Buttons, which can be invoked by GET requests. Not only can it to run Alexa Routines but the skill also has Text-to-speech capabilities which this forum might find interesting. For me, the more interesting capability, is the the skills ability to allow Alexa to ask Yes or No question, and respond differently based on your answer.

There is nominal yearly fee to get "Pro" features which include Text-to-Speech announcements, sounds, etc.. https://voicemonkey.io/

Using the API to trigger Alexa Routines and Text-to-speech works perfectly in my testing, although I am having some trouble with the Yes/No prompting. The prompt works fine if I respond, but not so much if I do not.

I was a bit surprised to seemingly not see this Amazon skill mentioned anywhere in the forums, given this is SO MUCH easier than how I got Alexa Text-to-speech working on my system.

Is anyone else using the Voice Monkey skill and more importantly, has anyone gotten the Yes/No prompting to work?

Posted on
Thu Mar 31, 2022 4:51 am
anyone offline
User avatar
Posts: 125
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: Alexa Voice Monkey Skill can run routines w/an API & s

I was able to get Yes/No prompt to work after engaging the skill developer, he discovered an issue with the skill's language files.

As mentioned, Yes/No prompting was the capability I needed from this skill. If the other capabilities were needed, such as the free virtual triggers which can remotely trigger Alexa Routines or the "Pro" feature of Text-to-Speech.

One way you could use this skill for those two things is by creating a Python script, " voice_monkey_api.py ", and placing it in the path; /Library/Application Support/Perceptive Automation/Python2-includes

This would allow you to call it from anywhere within Indigo, i.e. Triggers and Action Groups, with two lines of Python code.

For Alexa Routines:

Code: Select all
from voice_monkey_api import  alexa_routine
alexa_routine("a monkey associated with an Alexa routine")


For Alexa Text-to-speech:

Code: Select all
from voice_monkey_api import alexa_speak
alexa_speak("I told you this was easy", "a monkey associated with an Alexa device")


voice_monkey_api.py

Code: Select all
#!/usr/bin/python

import requests
# from urllib.parse import quote # python3
from urllib import quote # python2

ACCESS_TOKEN = "my access token"
SECRET_TOKEN = "my secret token"
       

def alexa_speak(what_to_say, monkey='your default echo device'):

    payload = {"access_token": ACCESS_TOKEN,
               "secret_token": SECRET_TOKEN,
               "monkey_name": "-".join(monkey.split()),
               "say_this": quote(what_to_say)}

    url = ('https://api.voicemonkey.io/trigger?access_token={access_token}&secret_token={secret_token}'
           '&monkey={monkey_name}&announcement={say_this}')

    make_request(url, payload)


def alexa_routine(monkey):
   
    payload = {"access_token": ACCESS_TOKEN,
               "secret_token": SECRET_TOKEN,
               "monkey_name": "-".join(monkey.split())}

    url = ('https://api.voicemonkey.io/trigger?access_token={access_token}&secret_token={secret_token}'
           '&monkey={monkey_name}')

    make_request(url, payload)


def make_request(url, payload):

    try:
        response = requests.get(url.format(**payload), timeout=5)
        response.raise_for_status()
        # Code here will only run if the request is successful
    except requests.exceptions.HTTPError as errh:
        indigo.server.log("{0}".format(errh))
    except requests.exceptions.ConnectionError as errc:
        indigo.server.log("{0}".format(errc))
    except requests.exceptions.Timeout as errt:
        indigo.server.log("{0}".format(errt))
    except requests.exceptions.RequestException as err:
        indigo.server.log("{0}".format(err))

Posted on
Thu Mar 31, 2022 9:00 am
jay (support) offline
Site Admin
User avatar
Posts: 18212
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Alexa Voice Monkey Skill can run routines w/an API & s

Pretty cool, once we're done with the Apple fire drill I'll have to play with it some.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Mar 31, 2022 10:18 am
neilk offline
Posts: 715
Joined: Jul 13, 2015
Location: Reading, UK

Re: Alexa Voice Monkey Skill can run routines w/an API & s

Started playing with this, but it does look very cool and options to integrate with blue iris and indigo.

Thanks for pointing this out.

Neil

Posted on
Thu Apr 07, 2022 11:21 am
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Alexa Voice Monkey Skill can run routines w/an API & s

Awesome find and thank you for sharing!

Posted on
Mon Apr 25, 2022 12:42 pm
anyone offline
User avatar
Posts: 125
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: Alexa Voice Monkey Skill can run routines w/an API & s

If anyone successfully gets an Audio File to play with this skill, please share how you did it.

I am not having any success and I really really don't want to learn how to create a Amazon skill, just for that purpose.

Posted on
Thu Jan 26, 2023 7:28 am
anyone offline
User avatar
Posts: 125
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: Alexa Voice Monkey Skill can run routines w/an API & s

anyone wrote:
If anyone successfully gets an Audio File to play with this skill, please share how you did it.

I am not having any success and I really really don't want to learn how to create a Amazon skill, just for that purpose.


I got this working. It's not clear to me why I had problems a few months. (https not http, file format, file size, dunno.)

A YouTube video I came across gave some info on how to host the file in dropbox by creating a public link to it.

You would change:
https://www.dropbox.com/s/dqk73c2cduxjg6k/one_dog_barking_audacity.mp3?dl=0

To this:
https://dl.dropboxusercontent.com/s/dqk73c2cduxjg6k/one_dog_barking_audacity.mp3?dl=1

I'll leave these up, if anyone wants to use the link in the Playground.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 12 guests