HTTP Bot Callback
The Bot HTTP callback is a powerful mechanism used to find out what happens to your bot.
The Bot calls your HTTP script when something important happens: someone invites the bot to a group, gives money to the bot, says something in local chat.
Sometimes you can control your bot's behavior: for example, decide to accept or decline the group invitation.
Using HTTP callback
1. Initialize HTTP callback
Tell your bot that you wish to receive HTTP callbacks: use set_http_callback API call:
// Command bot to send all callback events to you string params = llDumpList2String([ "action=" + "set_http_callback", "apikey=" + llEscapeURL(yourApiKey), "botname=" + llEscapeURL("YourBot Resident"), "secret=" + llEscapeURL(botSecretCode), "url=" + "http://www.your-website.com/your-script-name.php", "events=" + llEscapeURL("all") ],"&"); llHTTPRequest("http://api.mysmartbots.com/api/bot.html", [HTTP_METHOD,"POST"], params);
2. Parse messages from the bot
Bot calls your HTTP script and passes event-specific parameters. For example, you get the group name and group UUID for group invitation event. See the "Examples" section at the end of the page.
Visit HTTP Bot Callback Events for a complete list of events and their parameters.
3. Reply to the bot
Sometimes the bot expects your reply: to allow joining a group or accepting a frendship offer. This is being done by generating a response string in your HTTP script.
The format of the reply string is similar to URL encoding: key1=value1&key2=value2... For example, the reply to accept group invitation is
In-world event: your bot SamuraiOfLight got invited to the group by Fashion Firethorn. Bot reaction: your HTTP callback script will get the following data from the bot:
action=group_invite avatar_name=fashion firethorn bot_name=SamuraiOfLight Resident bot_uuid=3c525949-fdb7-4ab6-b5c2-bf3b4c5145be group_uuid=0b65a122-8f77-64fe-5b2a-225d4c490d9c system_message=Fashion Firethorn (fashion.firethorn) has invited you to join a group. There is no cost to join this group. Group: SmartBots: group invitation bots: Direct group inviter just for L$79 per week! Plus chat manager, notice sender and a lot of unique features