Yesterday I created the conversation flow to get topics. I need to add the recommendations from topic today, as well as to add the flows to sites and categories.

Oh, I had a problem to take a string that represent the user id in alexa, and convert it to a uuid, which I can then use with the outbrain endpoint. I searched, and didn’t find an answer yet. I’ll have to look into it later on.

I tried to implement the site’s flow. I spent most of the time of 2 pomodoros on getting Alexa to recognize and pass the name of a site or topic. I tried to use the AMZN:LITERAL type, assuming that alexa will recognize whatever the user said and pass it on to me. But it didn’t, and kept getting me into an infinit loop, recognizing only the GetTopic intent.

To over come this, I added two custom types:

  • ENTITY_TYPE – list the utterances for a type of recommendation (topic, site or category)
  • ENTITY_NAME – I added top sites and topics to that list, and added the slot with that type to the intent. This way I hope alexa will recognize the utterances better, and pass them along to the server, where I manage contexts and be able to tell if a user ment Yahoo site or Topic.


Started the Outbrain News skill for alexa.

For general reference, here’s the flow of creating a new app:

~/dev/sphere $ mkdir alexa-outbrain-news
~/dev/sphere $ cd alexa-outbrain-news/
~/dev/sphere/alexa-outbrain-news $ pyenv virtualenv 3.5.0 outbrain-news
Using base prefix '/Users/ygilad/.pyenv/versions/3.5.0'
New python executable in /Users/ygilad/.pyenv/versions/3.5.0/envs/outbrain-news/bin/python3.5
Also creating executable in /Users/ygilad/.pyenv/versions/3.5.0/envs/outbrain-news/bin/python
Installing setuptools, pip, wheel...done.
Ignoring indexes: https://pypi.python.org/simple
Requirement already satisfied (use --upgrade to upgrade): setuptools in /Users/ygilad/.pyenv/versions/3.5.0/envs/outbrain-news/lib/python3.5/site-packages
Requirement already satisfied (use --upgrade to upgrade): pip in /Users/ygilad/.pyenv/versions/3.5.0/envs/outbrain-news/lib/python3.5/site-packages
(news-briefing) ~/dev/sphere/alexa-outbrain-news $ pyenv local outbrain-news
(outbrain-news) ~/dev/sphere/alexa-outbrain-news $ touch dlog.org
(outbrain-news) ~/dev/sphere/alexa-outbrain-news $ touch server.py
(outbrain-news) ~/dev/sphere/alexa-outbrain-news $ touch rest-client.org

And now in Emacs, I want to create the workspace for that project:

  • Open the 3 files that I’ve just created, and orginize the windows to my liking.
  • And now I have to save this view as a new workgroup:
    • C-c z c to create a new workgroup
    • Give the workgroup name

And here’s how my emacs window looks like, ready for me to start writing: creating-a-new-project.png

Initial design of the skill

Here’s a sequence diagram of the first interaction with the skill:



Setting up the environment

  • Installing some basic python packages in the new pyenv:

pip install jedi importmagic autopep8 flake8

  • Installing flask and flask-ask, which are more specific to the project.

pip install flask flask-ask

Start the flask application

I can run the server using python server.py, but the server won’t restart when I make changes. I need to run it with flask:
$ export FLASK_APP=server.py
$ flask run --reload

I need to connect Emacs…

I need to connect org2blog to this dlog.



Weather-outfit algorithm

  • set current time
  • set bucket
  • if not evening bucket:
    • set max time as end of next bucket
  • else
    • set max time as end of this bucket
  • iterate on temperature from now till max time
    • set min_temperature
    • set max_temperature
    • set max percepitation chances
    • set max wind gahst


I’m going to change the call for recommendations and the invocation of agolo. Appernetly we already have the access to the summaries, so I can use a POST request to get the documents with their summaries, and hence reduce the respond time significantly.

POST https://sphere-dev.outbrain.com/Omakase/sphere/v1/summaryByContent/
Authorization: {API_KEY key-goes-here}
Content-Type: application/json
Cache-Control: no-cache
  "url" : "http://money.cnn.com/2016/11/30/technology/netflix-download-feature/index.html"

Ok, so I only get the summary, without any other information. I will still have to call a summation service. Maybe I should just add a function, that will live alongside the agolo’s one. This way I can switch between the two endpoints in the future.

Changed the get_summary function. I added support for sphere summary, and prioritized it over agolo. If there’s an issue with sphere, I try the agolo summation.

Also, I managed to solve the issue with the formating of the publish date I get from sphere. This answer in stack-overflow helped me with the reformating.


  • Note taken on [2016-12-04 Sun 19:58]
  • Starting with the video tutorial here

In order to create the intent data model, it will be helpful to first understand what type of intents I want to support. Basically, I want to set and get information.

Question: do I want to differentiate between different types of information? numbers and strings for exampls. Also, do I want to give variable names to pieces of information, for future reference and extraction?

Mini spec


  • SetClipboard
  • GetClipboard



  • SetClipboard remember {number}
  • SetClipboard remember this {sentence}


  • GetClipboard, get clipboard information

Invocation name

  • Clipboard
  "intents": [
      "intent": "SetClipboard",
      "slots": [
      "name": "Text",
      "type": "LITERAL"