Difference between revisions of "HTTP API/Examples/Sending group invitation"

From SmartBots Developers Docs
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE: Group Invite}}
+
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
 
The following example demonstrates the usage of [[HTTP_API/Bot_Commands/group_invite|group_invite]] API command.
 
The following example demonstrates the usage of [[HTTP_API/Bot_Commands/group_invite|group_invite]] API command.
  
Line 27: Line 27:
 
             "avatar="  + llEscapeURL(llDetectedKey(0)),
 
             "avatar="  + llEscapeURL(llDetectedKey(0)),
 
             "groupuuid=" + llEscapeURL((string)groupUUID),
 
             "groupuuid=" + llEscapeURL((string)groupUUID),
             "roleuuid=" + llEscapeURL((string)roleUUID),
+
             "roleuuid=" + llEscapeURL((string)roleUUID)
 
+
            "message=" + llEscapeURL(message),
+
 
             ], "&");
 
             ], "&");
  
         llHTTPRequest("http://api.mysmartbots.com/api/bot.html",
+
         llHTTPRequest("https://api.mysmartbots.com/api/bot.html",
 
             [HTTP_METHOD,"POST"], params);
 
             [HTTP_METHOD,"POST"], params);
 
     }
 
     }
 +
}
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Latest revision as of 13:16, 29 October 2018

The following example demonstrates the usage of group_invite API command.

It delivers invitation to everyone who touches your object.

Sending the group invitation to avatar

string sbApiKey="...";
string sbBotName="...";
string sbBotAccessCode="...";

key groupUUID="....";
key roleUUID="..."; // NULL_KEY for "Everyone"

string message="Welcome to our group!";

default {
    touch_start(integer total_number) {
        string params = llDumpList2String([
            "action="  + "group_invite",

            "apikey="  + llEscapeURL(sbApiKey),
            "botname=" + llEscapeURL(sbBotName),
            "secret="  + llEscapeURL(sbBotAccessCode),

            "avatar="  + llEscapeURL(llDetectedKey(0)),
            "groupuuid=" + llEscapeURL((string)groupUUID),
            "roleuuid=" + llEscapeURL((string)roleUUID)
            ], "&");

        llHTTPRequest("https://api.mysmartbots.com/api/bot.html",
            [HTTP_METHOD,"POST"], params);
    }
}