Skip to main content

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:

  1. Create the HTTP request block in your script.

  2. Select the POST method.

  3. Copy the following link to the URL field:

    https://tools.aimylogic.com/api/data/${userId}

  4. 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]}

  5. You don’t need to fill in the RESPONSE and HEADERS tabs.

HTTP request block example

Reading data

To read data from your database:

  1. Create the HTTP request block in your script.

  2. Select the GET method.

  3. Copy the following link to the URL field:

    https://tools.aimylogic.com/api/data/${userId}

  4. 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.

  5. You don’t need to fill in the BODY and HEADERS 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:

  1. Create the HTTP request block in your script.

  2. Select the DELETE method.

  3. Copy the following link to the URL field:

    https://tools.aimylogic.com/api/data/${userId}

  4. You don’t need to fill in the RESPONSE, BODY, and HEADERS tabs.