# SB_INVITE_SEND

Invites resident to the group.

## Command usage

```csharp
llMessageLinked(LINK_SET, SB_INVITE_SEND, string str, key id);
```

## API parameters

`llMessageLinked` function accepts `str` and `id` parameters. Their meaning for `SB_INVITE_SEND` is explained below:

| Variable | Required | Description |
|----------|----------|-------------|
| str      | yes      | flags, separated by commas<br><br>The following flags can be used:<br><br>`"FORCE"`- send invitation to existing group members<br>`"Role:role-name"` - invite to specific role instead of "Everyone" |
| id       | yes      | avatar UUID |

## Comments

### Avoiding invitation spam

By default, SmartBots does not invite existing group members. Bot reads the list of existing members every 15–20 minutes. Thus:

* if avatar leaves the group, bot will not invite him to the group during the next 20 minutes.
* if avatar just joined the group, an immediate second join command will send another group invitation (bot still does not know about new group member).

To invite existing group members too, use the `"FORCE"` flag to invite them too.

### Roles

By default, an invitation is being sent to "Everyone" role. This can be changed by using the `Role` flag.


1. **Use the role name, not the role title!** The name is case-sensitive

Make sure that you use the role name. Using the role title (or the role tag name) won't work. Also remember that role name is cAsE SeNsItIvE!

If role-name is misspelled, then invite will work though but will invite avatars to default Everyone role.


2. **Give the necessary permissions to the bot!**

Inviting to the specific role requires additional group setup:

* "Assign members to Assigner's Roles" ability given to the bot
* Bot has to be a member of that role

If bot has lack abilities, the flashing pop-up appears in viewer of the invited person, reporting that "Inviter is lack of permission...".

Read [Inviting residents to custom role](/doc/inviting-and-ejecting-from-custom-role-xLBQ50f6Xi) page for more details.

## Examples

### Invite resident to the group on touch

```csharp
touch_start(integer detected) {
  // "FORCE" means to invite existing group members too
  llMessageLinked(LINK_SET, SB_INVITE_SEND, "", llDetectedKey(0));
}
```

### Invite resident to the custom role

```csharp
touch_start(integer detected) {
  // We use the "Role" flag to specify the role
  llMessageLinked(LINK_SET, SB_INVITE_SEND, "Role:Tenants", llDetectedKey(0));
}
```

Also see [Group Inviter Script](/doc/group-inviter-script-PdoZUBQlmP) for a complex group inviter example.