https://bot-api.targethunter.ru/external-api/v2/funnels/getById
Показывает одну воронку со статистикой по каждому шагу.
Нужен личный токен с продуктом BotHunter — как получить. Кому доступен: владельцу сообщества и сотрудникам с любой ролью.
| ID воронки — Пример: |
Возвращает объект воронки со статистикой по шагам в поле steps.
{
"status": "ok",
"response": {
"id": "65a6e5f4c0e8f20012d3a456",
"title": "Запись на консультацию",
"budget": 5000,
"budget_type": "custom",
"source_only": false,
"freeze_at": null,
"create_at": 1704067200,
"counted_at": 1735689600,
"steps": [
{
"id": "65a6e5f4c0e8f20012d3a457",
"type": "start",
"title": "Подписались",
"count": 200,
"cost": 25,
"values": 0,
"avg_value": 0,
"profit": -25,
"reach_percent": null,
"connects": [
"65a6e5f4c0e8f20012d3a458"
],
"connected_percents": {
"65a6e5f4c0e8f20012d3a458": "40"
}
}
]
}
}Общие ошибки — на странице API.
Код | Когда |
|---|---|
| «Воронка не найдена»: воронки с таким |
Подставьте свой токен вместо <ваш_токен>.
curl -X POST https://bot-api.targethunter.ru/external-api/v2/funnels/getById \
-H "Authorization: Bearer <ваш_токен>" \
-H "Content-Type: application/json" \
-d '{"funnel_id": "65a6e5f4c0e8f20012d3a456"}'$token = '<ваш_токен>';
$url = 'https://bot-api.targethunter.ru/external-api/v2/funnels/getById';
$params = [
'funnel_id' => '65a6e5f4c0e8f20012d3a456',
];
$curl = curl_init($url);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $token,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($params),
]);
$response = json_decode(curl_exec($curl), true);
curl_close($curl);import requests
token = '<ваш_токен>'
url = 'https://bot-api.targethunter.ru/external-api/v2/funnels/getById'
params = {
'funnel_id': '65a6e5f4c0e8f20012d3a456',
}
response = requests.post(url, json=params, headers={'Authorization': f'Bearer {token}'})
print(response.json())const token = '<ваш_токен>';
const params = {
"funnel_id": "65a6e5f4c0e8f20012d3a456"
};
const response = await fetch('https://bot-api.targethunter.ru/external-api/v2/funnels/getById', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(params),
});
console.log(await response.json());