# invite

Sends the group invitation to specific resident.

```none
// HTTP request to:
// https://api.mysmartbots.com/api/simple.html
// with action=invite and required parameters
```

# Input

| Variable | Required | Description |
|----------|----------|-------------|
| `action` | Yes      | Must be `"invite"`. |
| `apikey` | Yes      | Your personal developer's API key. |
| `secret` | Yes      | Security code of the group you are using. |
| `secret_sha1` | *Optional* | Same as `secret` but hashed with SHA1. |
| `group`  | Yes      | The group name (must be listed with SmartBots!). |
| `slkey`  | Yes      | The UUID of the resident. |
| `role`   | *Optional* | The group role name (default: `"Everyone"`). |
| `message` | *Optional* | A message to send along with the invitation. Cannot contain international characters. |
| `force`  | *Optional* | If set to `1`, invites existing group members too. Otherwise, they are silently ignored. |
| `cooldown` | *Optional* | Do not send another invite to this resident for X seconds. Max value: `86400` (24 hours). |
| `location` | *Optional* | A custom location string shown in statistics. Format: `REGION NAME/X/Y/Z` |
| `misc`   | *Optional* | Custom misc value shown in group invitation statistics. Max 60 characters. |

# Output (Plain text)

| `"OK"` | Command completed successfully. |
|------|---------------------------------|
| *anything else* | Request failed. The failure reason is returned in plain text. |

# Example

## Basic

```none

POST https://api.mysmartbots.com/api/simple.html

action=invite

apikey=YOUR_API_KEY

secret=YOUR_GROUP_SECRET

group=My Group Name

slkey=00000000-0000-0000-0000-000000000000

message=Welcome!

force=1
```

## CURL

```bash
curl -X POST https://api.mysmartbots.com/api/simple.html \
  -d "action=invite" \
  -d "apikey=YOUR_API_KEY" \
  -d "secret=YOUR_GROUP_SECRET" \
  -d "group=My Group Name" \
  -d "slkey=00000000-0000-0000-0000-000000000000" \
  -d "message=Welcome!" \
  -d "force=1"
```

## LSL

```csharp
touch_start(integer num) {
  string params = llDumpList2String([
    "action="  + "invite",
    "apikey="  + llEscapeURL(yourApiKey),
    "secret="  + llEscapeURL(groupSecretCode),
    "group="   + llEscapeURL("My Group Name"),
    "slkey="   + (string)llDetectedKey(0),
    "force="   + "1",
    "message=" + llEscapeURL("Welcome!")],
    "&");

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