Commands › Bot & webhooks
set_http_callback
Registers an HTTPS URL that the bot POSTs events to as they happen (IMs, invites, payments…). Posting a URL that is already registered adds the new events to it.
Usage
curl -X POST "https://api.lifebots.cloud/api/bot.html" \
-H "Content-Type: application/json" \
-d '{
"action": "set_http_callback",
"apikey": "YOUR_API_KEY",
"botname": "Joe Resident",
"secret": "bot-secret-123",
"url": "https://yourapp.com/hooks/YOUR_SECRET",
"events": "instant_message,group_invite",
"dataType": "json"
}' Every request also needs apikey, botname and secret — see Authentication.
Parameters
| Name | Required | Description |
|---|---|---|
urlstring | no | Webhook URL. Required to add. With operation=remove and no url, every webhook is removed. |
eventsstring | no | Comma-separated events, or all. Valid: instant_message, chat_message, group_message, group_invite, balance_changed, script_dialog, online_status, teleport_status, offer_teleport, offer_friendship, offer_inventory, start_typing, stop_typing. Default: all |
operationstring | no | add or remove. Default: add |
Returns
| Field | Type | Description |
|---|---|---|
id | string | Id of the webhook that was added or updated. |
urls | array | Every webhook on the bot after the change: {id, url, events}. |
Example response
{
"result": "OK",
"resulttext": "HTTP callback registered with 2 events",
"id": "cb_8f2a",
"urls": [
{
"id": "cb_8f2a",
"url": "https://yourapp.com/hooks/YOUR_SECRET",
"events": [
"instant_message",
"group_invite"
]
}
]
} With dataType=json. A failure has result: "FAIL" and the reason in resulttext — see Responses & errors.
Good to know
- One unknown event name fails the whole call.
- operation=remove without a url deletes every webhook on the bot.
- A URL that keeps failing for 24 hours is removed automatically. Deliveries are not retried.