From SmartBots Developers Docs
Jump to: navigation, search

Sends an Instant Message to a specific user.

// See "LSL Helper Functions" page for this function
smartbotsAPI("im", [
  "slname", "Glaznah Gassner",
  "message", "Hello in-world!"


The following table shows input values (you send them with the API call) and returned output values.

Variable Required Description.
Input basic parameters:
action yes = im
apikey yes Your personal developer's API key.
botname yes Your bot's SL login.
secret yes Bot access code of your bot.
dataType no Set to "json" to get JSON reply instead of URL-encoded string
custom no The custom data (string) to be passed back to caller script. This value will be returned back to the caller in HTTP response.
slname yes
  • Second Life login name of avatar


  • avatar UUID
message yes The message to send
result OK - command completed successfully
FAIL - command failed
resulttext Detailed reason for the failure.
custom The value from input "custom" parameter. See above.


Send Instant Message to Tester Resident:

Send SmartBots HTTP API command.
smartbotsAPI(string command, list params) {
  // You need to adjust the vars below:
  string sbApiKey = "...";
  string sbBotName = "...";
  string sbBotAccessCode = "...";

  // Populate the query data
  list query = [
    "action="  + command,
    "apikey="  + llEscapeURL(sbApiKey),
    "botname=" + llEscapeURL(sbBotName),
    "secret="  + llEscapeURL(sbBotAccessCode)

  integer i;
  for(i = 0; i<llGetListLength(params); i += 2) {
    query += [ llList2String(params, i) + "=" + llEscapeURL(llList2String(params, i+1)) ];

  string queryString = llDumpList2String(query, "&");
    [HTTP_METHOD,"POST"], queryString);

Usage example:

smartbotsAPI("im", [
  "slname", "Glaznah Gassner",
  "message", "Hello in-world!"
string recipient="Tester Resident";

string params = llDumpList2String([
  "action="  + "im",
  "apikey="  + llEscapeURL(sbApiKey),
  "botname=" + llEscapeURL(sbBotName),
  "secret="  + llEscapeURL(sbBotAccessCode),
  "slname="  + llEscapeURL(recipient),
  "message=" + llEscapeURL("Hello there!")
  ], "&");
  [HTTP_METHOD,"POST"], params);

<< return back to Bot commands

(Miss an API call or parameter? Submit your request in forum)