Lifebots symbol
Lifebots.cloud
OAuth 2.0 API
Guides

Start a bot and wait for it

Bot commands only work while the bot is online. Logging in takes anywhere from a few seconds to a minute, so Login Bot answers straight away with status: "connecting" and you check back until it's online.

Code

// Needs the bots:lifecycle scope
async function startBot(botId) {
  const headers = { Authorization: `Bearer ${accessToken}` }

  const res = await fetch(`https://api.lifebots.cloud/api/v1/bots/${botId}/login`, {
    method: 'POST',
    headers
  })
  const json = await res.json()
  if (!json.success) throw new Error(json.error.message) // e.g. PASSWORD_REQUIRED
  if (json.data.status === 'online') return              // already running

  // Logging in takes a while - poll every 5 seconds, for up to 2 minutes
  for (let i = 0; i < 24; i++) {
    await new Promise((r) => setTimeout(r, 5000))
    const bot = await fetch(`https://api.lifebots.cloud/api/v1/bots/${botId}`, { headers })
      .then((r) => r.json())

    if (bot.data.status === 'online') return
    if (bot.data.status === 'error') throw new Error(bot.data.botError)
  }
  throw new Error('Bot did not come online in time')
}

What can go wrong

You getWhyWhat to do
PASSWORD_REQUIREDLifeBots has no Second Life password for the bot.Ask the user to set it on lifebots.cloud.
BOT_EXPIREDThe bot's subscription ran out.Ask the user to renew it.
status errorSecond Life refused the login.Show botError to the user.
Prefer not to poll? Subscribe to the online_status webhook and wait for ONLINE or LOGIN_ERROR.
Lifebots symbol
Lifebots.cloud

Empowering Second Life experiences with intelligent bot automation and seamless group management solutions.

Product
Support
Company
Visit Us

© 2025 - 2026 LifeBots. Made with ❤️. All rights reserved.

LifeBots is not affiliated with Linden Research, Inc., or any of its affiliated entities or products, including, without limitation, Second Life (collectively, “Linden Lab”).

Initializing A New World of Second Life Bots...