Пользователь бота

Bot_user - это конкретный контакт с которым общается бот.

Get BotUsers

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

Получение списка объектов bot_user

Query Parameters

NameTypeDescription

shop_id

integer

ID магазина

search

string

Фильтр по полям: -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/

Получение данных объекта bot_user

Path Parameters

NameTypeDescription

id

integer

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/

Обновление данных объекта bot_user и привязанного к нему store (например, значение переменных)

Path Parameters

NameTypeDescription

id

integer

ID объекта bot_user

Query Parameters

NameTypeDescription

shop_id

integer

ID магазина

Request Body

NameTypeDescription

state

object

Статус пользователя (объект типа dict)

lang_code

string

Код языка, например ru или en

name

string

Имя пользователя

avatar_url

string

URL аватара пользователя

messager_user_url

string

URL пользователя в мессанджере

store

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": []
                }
            }
}

Объект store

Параметр

Тип

Описание

name

string

Имя пользователя

phone

string

Телефон

avatar_url

string

URL аватара пользователя

subscribe_to_bot

boolean

Подписан ли пользователь на бота

tags

array

Теги присвоенные пользователю

user_vars

object

Объект типа dict содержащий переменные пользователя и их значения (например, {'var1':'some text', 'var2': 15}).

Для того, чтобы установить значение переменной надо отправить запрос следующего содержания: { "store": { "user_vars": { "goods":5 } } } Это установит значение переменной "good" равным 5.

Для того, чтобы добавить тег надо отправить запрос: { "store": { "tags": [{ "id": 13 } ] } }

Для того, чтобы удалить теги надо отправить запрос: { "store": { "tags": [] } }

Create BotUser

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

Создаёт объект BotUser

Request Body

NameTypeDescription

bot_id

string

ID бота

shop_id

string

ID магазина

chat_type

string

Тип чата. 1 - приватный 2 - групповой

chat_id_in_messenger

string

ID чата в мессенджере

chat_name_in_messenger

string

Имя чата в мессенджере

chat_avatar_in_messenger

string

URL аватара чата в мессенджере

chat_url_in_messenger

string

URL чата в мессенджере

bot_user_id_in_messenger

string

ID пользователя в мессенджере

bot_user_name_in_messenger

string

Имя пользователя в мессенджере

bot_user_avatar_in_messenger

string

URL аватара пользователя в мессенджере

bot_user_url_in_messenger

string

URL пользователя в мессенджере.

subscribe_flow

string

Подписывать ли пользователя на сценарий по умолчанию. По умолчанию = False

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

Última actualización