Databases
You can use this service to save, read and delete any data associated with the bot’s user.
Writing data
To write some data to your database:
Create the HTTP request block in your script.
Select the
POST
method.Copy the following link to the URL field:
https://tools.aimylogic.com/api/data/${userId}
Specify a JSON object in the
BODY
tab of your HTTP query, containing any data you wish to save. For example:{ "var1": "value", "var2": 100, "var3": [1,2,3]}
You don’t need to fill in the
RESPONSE
andHEADERS
tabs.
Reading data
To read data from your database:
Create the HTTP request block in your script.
Select the
GET
method.Copy the following link to the URL field:
https://tools.aimylogic.com/api/data/${userId}
In the
RESPONSE
tab, specify the name of the variable that will hold your data and specify the desired value in the Value field, e.g.$httpResponse
.You don’t need to fill in the
BODY
andHEADERS
tabs.
If no data can be found for that user, your request will return the 404 error. If some data is found, the object previously saved to the database will be written to the $httpResponse
variable.
Deleting data
To clear all the data for the current user:
Create the HTTP request block in your script.
Select the
DELETE
method.Copy the following link to the URL field:
https://tools.aimylogic.com/api/data/${userId}
You don’t need to fill in the
RESPONSE
,BODY
, andHEADERS
tabs.