Guides
Invite someone to a group
A bot can moderate any Second Life group it belongs to — the group does not need to be registered on LifeBots. You need the group's UUID, the role's UUID and the avatar's UUID.
Code
// Needs bots:groups. Uses the lifebots() helper from "Making requests".
// 1. Pick a bot, and a group it belongs to
const { bots } = await lifebots('GET', '/bots')
const botId = bots[0].agentId
const { groups } = await lifebots('GET', `/bots/${botId}/groups/simple`)
const group = groups.find((g) => g.name === 'My Group')
// 2. Make sure the bot is allowed to invite there
const { powers } = await lifebots('GET', `/bots/${botId}/groups/${group.id}/powers`)
if (!powers.includes('Invite')) throw new Error('Give the bot a role with the Invite power')
// 3. Find the role to invite into
const { roles } = await lifebots('GET', `/bots/${botId}/groups/${group.id}/roles`)
const members = roles.find((r) => r.name === 'Members')
// 4. Invite
await lifebots('POST', `/bots/${botId}/groups/${group.id}/invite`, {
avatar: 'b9e1c2d3-4f5a-4b6c-8d7e-9f0a1b2c3d4e',
roleuuid: members.id
})
// Later: promote them, or remove them
await lifebots('POST', `/bots/${botId}/groups/${group.id}/members/${avatarId}/roles`, {
roleuuid: officersRoleId
})
await lifebots('POST', `/bots/${botId}/groups/${group.id}/eject`, { avatar: avatarId })Only have a name? Turn it into a UUID with Name → UUID.
Before you start
- In Second Life, give the bot a role with the Invite people, Eject members or Assign members to roles abilities you need. Without them the call returns OK but nothing happens — so check first with Bot Powers in a Group (step 2).
- To invite into a role other than Everyone, the bot must be allowed to assign that role.
- Each avatar can be invited to the same group once every 5 minutes. A repeat gets
result: "FAIL"with the time left.
Related
- Bot Powers in All Groups — find every group where the bot can invite, in one call.
- List Members — check who's in the group, with titles and powers.
- Send Group Notice and Send Group Chat.
- Answer Group Invite — when the bot is the one being invited.