Cookies Recipe

From Evo Voice
Jump to: navigation, search


Cookies are a feature that allow you to store arbitrary string data against a unique calling identifier (for example on Incoming Phone Number calls this would be the caller ID, for incoming Skype messages it would be the user name).

Cookies function similarly to how they do in a web environment. They have a name and a value, but instead of being stored by a browser, they are stored in the database with a key based on the incoming ID (caller ID etc.)


There are three main nodes for Cookies, Get Cookie Node, Set Cookie Node and Delete Cookie Node.


Let's create a simple example which first checks to see if we have a cookie for the incoming message, if so, we will welcome the user back, otherwise, we will prompt them for their name and save it in a cookie.

The finished flow looks like the following:


Let's take a look at each node individually.

First up, we have the Get Cookie node


You can see that we use a cookie name of "Name" and we store the cookie in our flow parameter Name. The Found transition will happen if there exists a cookie with that name for this caller otherwise we will go to the Not Found Transition.

The first time through, the cookie won't exist and our Prompt node just collects the information from the sender, e.g.


We store the Name in our Flow Parameter and then we use the Set Cookie to also set a cookie for this value.

Finally we greet the person.

The second time through, the cookie will exist, and we will put the cookie into our Flow Parameter Name. We will then just greet using a template: