Introducing Anonymous Talk API

If you’ve developed your bot to remember conversational elements, and you’d like to have it remember them past an active session with your end-users but don’t want to maintain any kind of end-user management, the new Anonymous Talk API can solve that issue!

This API will allow you to request creation of an end-user client_name on the AIaaS platform that will maintain persistent predicates for anonymous end-users talking to your bot(s), without you having to maintain end-user profiles on your website or application.

Previously, you had the option to pass in a client_name to identify your end-users. This would allow predicates to persist throughout a given chat session, but eventually fall out of the bot’s memory. By using a client_name retrieved from the Anonymous Talk API, your end-user’s predicates will persist beyond this limited scope.

Getting Started

The Anonymous Talk API is similar to the Talk to Bot API in that to start a talk interaction with your bot with a brand new end-user, at minimum you will need your application ID (APP_ID), user key (USER_KEY), bot name (BOTNAME), and input message to your bot (INPUT). A sample cURL command would be:

curl -v -X POST 'https://aiaas.pandorabots.com/atalk/APP_ID/BOTNAME?user_key=USER_KEY&input=INPUT'

Sending the HTTP request without the client_name parameter will indicate to AIaaS that you are requesting a new end-user account. The HTTP response will return a JSON object such as:

{ "status": "ok",  
"responses": [<OUTPUT>],
"sessionid": <SESSION_ID> ,
"client_name": "aiaas-XXX-user-NNNN"
}

where <OUTPUT> is the bot response to the input received, <SESSION_ID> is a sequential number generated by Pandorabots, and client_name is an anonymous end-user client name generated by Pandorabots, where XXX is your APP_ID and NNNN is a numeric starting with 0000, and increments by 1 after each new request.

Once an anonymous end-user client_name has been provided, your application should use this client_name in subsequent talk interactions (either Anonymous Talk or Talk to Bot API will work). Any predicates created in conversation with your bot will be associated with this new client_name and will persist indefinitely until overwritten.

Your application can save this client_name as an anonymous end-user either in a cookie, as a local variable in your application, or other mechanisms developed in your application.

NOTE OF CAUTION — When testing your application, not including a client_name will result in a new end-user client_name being created; make sure your application ONLY excludes this parameter for brand new end-users or else you may end up reaching your maximum limit on anonymous users.

BONUS!

Persistent Predicates for Known End-Users

This method can also be used for known end-users. In this case, the client_name provided by Pandorabots should be saved in your application’s database associated with your end-user’s profile, and used each time your end-user talks to your bot(s).


Originally published at blog.pandorabots.com on August 28, 2015.

Show your support

Clapping shows how much you appreciated Pandorabots’s story.