Is there a way to maintain context permanently ? such as an API key

263 views Asked by At

I'm using API.AI with a backend in Golang to create a chatbot that queries an API. This API needs a API key.

This API key is user specific, it does not reply the same answer for different users.

I understand that context in API.AI can persist informations but it lasts only for a session.

Is there a way to memorize indefinitely (more or less) an information ?

Thank you all

1

There are 1 answers

0
mattcarrollcode On

API.AI doesn't store most dynamic data beyond the session as you've already indicated. For data as secure as API or authentication keys I'd recommend a secure database or datastore outside of API.AI and using user IDs for the platform's your working with through API.AI to connect the user to their API/authentication key (API.AI passes through information about where the request is coming from the originalRequest attribute of the JSON sent with every webhook request).

For instance you can retrieve the ID of a user who accesses your API.AI agent through the Google Assistant with originalRequest.data.user.user_id, Slack users with originalRequest.data.user and Facebook users with originalRequest.data.sender.id