Difference between revisions of "HTTP API/Bot Commands/send notice"
From SmartBots Developers Docs
(Created page with "{{DISPLAYTITLE: send_notice}} <onlyinclude>Sends a notice to the group.</onlyinclude> {{API Variables Table}} {{API HTTP Required Vars|send_notice|Standard bot}} {{API Vari...") |
|||
Line 43: | Line 43: | ||
],"&"); | ],"&"); | ||
− | httpReq=llHTTPRequest(" | + | httpReq=llHTTPRequest("https://api.mysmartbots.com/api/bot.html", |
[HTTP_METHOD,"POST"], params); | [HTTP_METHOD,"POST"], params); | ||
} | } |
Revision as of 14:08, 7 September 2017
Sends a notice to the group.
Variables
The following table shows input values (you send them with the API call) and returned output values.
Variable | Required | Description | ||
---|---|---|---|---|
This API command applies only for Standard bot | ||||
Input basic parameters: | ||||
action | yes | = send_notice | ||
apikey | yes | Your personal developer's API key. | ||
botname | yes | Your bot's SL login. | ||
secret | yes | Bot access code of your bot. | ||
dataType | optional | Set to "json" to get JSON reply instead of URL-encoded string | ||
custom | optional | The custom data (string) to be passed back to caller script. This value will be returned back to the caller in HTTP response. | ||
Input: | ||||
groupuuid | yes | the UUID of the group | ||
subject | yes | the subject of the notice (can't contain international characters) | ||
text | yes | the text of the notice (can contain international characters) | ||
attachment | optional | inventory UUID of the attachment (see below) | ||
Output: | ||||
(to be received in http_response LSL event, see docs for details) | ||||
result | OK - command completed successfully FAIL - command failed | |||
resulttext | Detailed reason for the failure. | |||
custom | The value from input "custom" parameter. See above. |
Comments
- This command does not return FAIL if your bot has no "Send Group Notice" ability. Pay attention to bot's group permissions while using this command.
- The notice delivery is guaranteed even if the bot is offline (the invitation will be sent after bot comes online)
Example
string sbApiKey="...";
string sbBotName="Fashion Firethorn";
string sbBotAccessCode="nskndKgfa-243js";
key httpReq=NULL_KEY;
default {
touch_start(integer total_number) {
string params = llDumpList2String([
"action=" + "send_notice",
"apikey=" + llEscapeURL(sbApiKey),
"botname=" + llEscapeURL(sbBotName),
"secret=" + llEscapeURL(sbBotAccessCode),
"groupuuid=" + "877d11f0-72ad-649e-3ba2-96185b72d345",
"subject=" + llEscapeURL("Notice subject"),
"text=" + llEscapeURL("Notice text goes here")
],"&");
httpReq=llHTTPRequest("https://api.mysmartbots.com/api/bot.html",
[HTTP_METHOD,"POST"], params);
}
}
Attachments
The notice attachment can be taken from the bot's inventory. To make an attachment, proceed with the following steps:
- Set copy+transfer permissions to the object (so bot can give it with notice)
- Drop object to the bot in Second Life
- Open SmartBots account, click "manage bot":
- Open bot's inventory browser:
- Copy the "inventory UUID" of the required inventory item.
<< return back to Bot commands
(Miss an API call or parameter? Submit your request in forum)