Bot user

Bot_user - is the specific contact the bot is communicating with.

Get BotUsers

GET https://app.hightouch.ai/api/bot/bot_users/

Getting the list of bot_user objects

Query Parameters

NameTypeDescription

shop_id

integer

Store ID

search

string

Filter by field: -messenger_user_id -name -id

{
    "status": "ok",
    "result": {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
                    {
                "id": 13,
                "shop_id": 13,
                "created_at": "21.12.2020 - 23:32",
                "updated_at": "21.12.2020 - 23:32",
                "bot": {
                    "name": "Some Bot",
                    "bot_type": 13,
                    "id": 1313
                },
                "messenger_user_id": "79876543210",
                "state": {},
                "lang_code": "en",
                "name": null,
                "avatar_url": null,
                "messenger_user_url": null,
                "store": {
                    "id": 1313,
                    "active_flows": [],
                    "name": null,
                    "id_in_messenger": "79876543210",
                    "phone": null,
                    "avatar_url": null,
                    "start_parameter": null,
                    "subscribed_to_bot": true,
                    "tags": [],
                    "user_vars": {},
                    "saved_bank_cards": []
                }
            },
        ]
    }
}

Get BotUser

GET https://app.hightouch.ai/api/bot/bot_users/:id/

Getting the data of the bot_user object

Path Parameters

NameTypeDescription

id

integer

Object ID bot_user

{
    "status": "ok",
    "result": {
                "id": 13,
                "shop_id": 13,
                "created_at": "21.12.2020 - 23:32",
                "updated_at": "21.12.2020 - 23:32",
                "bot": {
                    "name": "Some Bot",
                    "bot_type": 13,
                    "id": 1313
                },
                "messenger_user_id": "79876543210",
                "state": {},
                "lang_code": "en",
                "name": null,
                "avatar_url": null,
                "messenger_user_url": null,
                "store": {
                    "id": 1313,
                    "active_flows": [],
                    "name": null,
                    "id_in_messenger": "79876543210",
                    "phone": null,
                    "avatar_url": null,
                    "start_parameter": null,
                    "subscribed_to_bot": true,
                    "tags": [],
                    "user_vars": {},
                    "saved_bank_cards": []
                }
            }
}

Update BotUser

PATCH https://app.hightouch.ai/api/bot/bot_users/:id/

Updating the data of the bot_user object and its associated store (e.g., the value of variables)

Path Parameters

NameTypeDescription

id

integer

Object ID bot_user

Query Parameters

NameTypeDescription

shop_id

integer

Store ID

Request Body

NameTypeDescription

state

object

User status (object of typr dict)

lang_code

string

Language code, like ru or en

name

string

Name of the user

avatar_url

string

User avatar URL

messager_user_url

string

User URL in messenger

store

object

Object store

{
    "status": "ok",
    "result": {
                "id": 13,
                "shop_id": 13,
                "created_at": "21.12.2020 - 23:32",
                "updated_at": "21.12.2020 - 23:32",
                "bot": {
                    "name": "Some Bot",
                    "bot_type": 13,
                    "id": 1313
                },
                "messenger_user_id": "79876543210",
                "state": {},
                "lang_code": "en",
                "name": null,
                "avatar_url": null,
                "messenger_user_url": null,
                "store": {
                    "id": 1313,
                    "active_flows": [],
                    "name": null,
                    "id_in_messenger": "79876543210",
                    "phone": null,
                    "avatar_url": null,
                    "start_parameter": null,
                    "subscribed_to_bot": true,
                    "tags": [],
                    "user_vars": {},
                    "saved_bank_cards": []
                }
            }
}

Object store

Parameter

Type

Description

name

string

User name

phone

string

telepphone

avatar_url

string

User avatar URL

subscribe_to_bot

boolean

Whether the user is subscribed to the bot

tags

array

Tags assigned to the user

user_vars

object

An object of type dict containing user variables and their values (e.g, {'var1':'some text', 'var2': 15}).

In order to set the value of a variable, you need to send a request with the following content: { "store": { "user_vars": { "goods":5 } } } This will set the value of the "good" variable to 5.

In order to add a tag, you need to send a request: { "store": { "tags": [{ "id": 13 } ] } }

In order to delete a tag, you need to send a request: { "store": { "tags": [] } }

Create BotUser

POST https://app.hightouch.ai/api/bot/bot_user/unsafe_create/

Creates an object BotUser

Request Body

NameTypeDescription

bot_id

string

Bot ID

shop_id

string

Store ID

chat_type

string

Type of thechat: 1 - private 2 - group

chat_id_in_messenger

string

Chat ID in messenger

chat_name_in_messenger

string

Name of the chat in messenger

chat_avatar_in_messenger

string

Chat avatar URL in the messenger

chat_url_in_messenger

string

Chat URL in the messenger

bot_user_id_in_messenger

string

User ID in messenger

bot_user_name_in_messenger

string

User name in messenger

bot_user_avatar_in_messenger

string

User avatar URL in messenger

bot_user_url_in_messenger

string

URL of the user in messenger

subscribe_flow

string

Whether to sign the user to the default script. Default = False

{ 
    "status": "ok",
    "result":
    {
        "bot_user_id": 5
    }
}

Last updated