# Events

An event is a callback function that is invoked when something happens with your bot or the surrounding world.

Callbacks are set using the `on()` function:

```javascript
Bot.on("instant_message", function(data) {
  console.log("bot got a message:", data);
});
```

## Events Reference

| **Messaging** |
|-----------|
| [`chat_message`](/doc/chat_message-5k9F59ud7u) | Fires when bot receives a message in the local chat |
| [`instant_message`](/doc/instant_message-ZIdYqPjDVk) | Fires when bot receives a message from another avatar or in-world object |
| [`start_typing`](/doc/start_typing-e3SwuiD2Id) | Fires when another avatar starts typing in IM to the bot*(Not available for QubicBot yet)* |
| [`stop_typing`](/doc/stop_typing-E88kVvCZMN) | Fires when another avatar stops typing in IM to the bot *(Not available for QubicBot yet)* |
| [`teleport_offer`](/doc/teleport_offer-QpWTCKBDPu) | Fires when bot receives a teleport offer from another avatar |
| **Group Messaging** |
| [`group_offer`](/doc/group_offer-VEO5cdkYnR) | Fires when bot receives a group invite |
| [`group_im`](/doc/group_im-AEBjSG8XC5) | Fires when bot receives a group chat message |
| [`group_notice`](/doc/group_notice-EojWA1JhaN) | Fires when bot receives a group notice |
| **Inventory** |
| [`inventory_offer`](/doc/inventory_offer-LT2RgJW4H0) | Fires when bot receives an inventory offer |
| [`balance_changed`](/doc/balance_changed-xmZuGSh533) | Fires when bot receives or pays money |
| **Friendship** |
| [`friendship_offer`](/doc/friendship_offer-AxLMvCycpI) | Fires when bot receives a friendship offer |
| **Movement** |
| [`autopilot_completed`](/doc/autopilot_completed-eHW4VcIviH) | Fires when bot autopilot successfully completes its journey *(Not available for QubicBot yet)* |
| [`autopilot_started`](/doc/autopilot_started-FE38qHN5CN) | Fires when bot autopilot starts *(Not available for QubicBot yet)* |
| [`autopilot_stuck`](/doc/autopilot_stuck-SaMFBdNbRR) | Fires when bot autopilot gets stuck and gives up moving further *(Not available for QubicBot yet)* |
| [`self_position`](/doc/self_position-xvBFpzKdMl) | Fires when bot in-world location, position, or heading changes *(Not available for QubicBot yet)* |
| [`sit`](/doc/sit-0g5VhrH2Sy) | Fires when bot sits on an object |
| [`teleport_status`](/doc/teleport_status-wNbGF6x4B1) | Fires when bot teleports, indicating various stages of the teleport *(Not available for QubicBot yet)* |
| **World** |
| [`avatar_tracker_update`](/doc/avatar_tracker_update-YtWcRMsf5I) | Reports position from avatars tracked by [`trackAvatars`](/doc/trackavatars-mNVmvYJgZA) command |
| [`region_restart`](/doc/region_restart-dz1XkBBjPh) | Fires when bot receives a region restart notification *(Not available for QubicBot yet)* |
| [`region_restart_cancelled`](/doc/region_restart_cancelled-q62JXw3EbB) | Fires when bot receives a region restart cancellation notification *(Not available for QubicBot yet)* |
| [`script_dialog`](/doc/script_dialog-feWFpgL8Ho) | Fires when bot receives a scripted dialog with menu buttons |
| **Online Status** |
| [`before_login`](/doc/before_login-fL3UKgmbn0) | Fires when bot is going to log in to Second Life |
| [`after_login`](/doc/after_login-GN66p4DpLR) | Fires when bot successfully logs in to Second Life |
| [`before_logout`](/doc/before_logout-6h4yCFO3PU) | Fires when bot is going offline |
| [`after_logout`](/doc/after_logout-jbSQO7CTqd) | Fires after bot goes offline *(Not available for QubicBot yet)* |
| [`login_error`](/doc/login_error-tcZfnneA7H) | Fires when bot is unable to log in to Second Life *(Not available for QubicBot yet)* |
| **Webhooks** |
| [`playground_webhook`](/doc/playground_webhook-PR60NUtXwF) | Fires when the script’s webhook receives an HTTP request from your server |

---

**Documents**

- [after_login](https://sb-docs-dev.getoutline.com/s/dev/doc/after_login-GN66p4DpLR)
- [after_logout](https://sb-docs-dev.getoutline.com/s/dev/doc/after_logout-jbSQO7CTqd)
- [autopilot_completed](https://sb-docs-dev.getoutline.com/s/dev/doc/autopilot_completed-eHW4VcIviH)
- [autopilot_started](https://sb-docs-dev.getoutline.com/s/dev/doc/autopilot_started-FE38qHN5CN)
- [autopilot_stuck](https://sb-docs-dev.getoutline.com/s/dev/doc/autopilot_stuck-SaMFBdNbRR)
- [avatar_tracker_update](https://sb-docs-dev.getoutline.com/s/dev/doc/avatar_tracker_update-YtWcRMsf5I)
- [balance_changed](https://sb-docs-dev.getoutline.com/s/dev/doc/balance_changed-xmZuGSh533)
- [before_login](https://sb-docs-dev.getoutline.com/s/dev/doc/before_login-fL3UKgmbn0)
- [before_logout](https://sb-docs-dev.getoutline.com/s/dev/doc/before_logout-6h4yCFO3PU)
- [chat_message](https://sb-docs-dev.getoutline.com/s/dev/doc/chat_message-5k9F59ud7u)
- [friendship_offer](https://sb-docs-dev.getoutline.com/s/dev/doc/friendship_offer-AxLMvCycpI)
- [group_im](https://sb-docs-dev.getoutline.com/s/dev/doc/group_im-AEBjSG8XC5)
- [group_notice](https://sb-docs-dev.getoutline.com/s/dev/doc/group_notice-EojWA1JhaN)
- [group_offer](https://sb-docs-dev.getoutline.com/s/dev/doc/group_offer-VEO5cdkYnR)
- [instant_message](https://sb-docs-dev.getoutline.com/s/dev/doc/instant_message-ZIdYqPjDVk)
- [inventory_offer](https://sb-docs-dev.getoutline.com/s/dev/doc/inventory_offer-LT2RgJW4H0)
- [login_error](https://sb-docs-dev.getoutline.com/s/dev/doc/login_error-tcZfnneA7H)
- [playground_webhook](https://sb-docs-dev.getoutline.com/s/dev/doc/playground_webhook-PR60NUtXwF)
- [region_restart](https://sb-docs-dev.getoutline.com/s/dev/doc/region_restart-dz1XkBBjPh)
- [region_restart_cancelled](https://sb-docs-dev.getoutline.com/s/dev/doc/region_restart_cancelled-q62JXw3EbB)
- [script_dialog](https://sb-docs-dev.getoutline.com/s/dev/doc/script_dialog-feWFpgL8Ho)
- [self_position](https://sb-docs-dev.getoutline.com/s/dev/doc/self_position-xvBFpzKdMl)
- [sit](https://sb-docs-dev.getoutline.com/s/dev/doc/sit-0g5VhrH2Sy)
- [start_typing](https://sb-docs-dev.getoutline.com/s/dev/doc/start_typing-e3SwuiD2Id)
- [stop_typing](https://sb-docs-dev.getoutline.com/s/dev/doc/stop_typing-E88kVvCZMN)
- [teleport_offer](https://sb-docs-dev.getoutline.com/s/dev/doc/teleport_offer-QpWTCKBDPu)
- [teleport_status](https://sb-docs-dev.getoutline.com/s/dev/doc/teleport_status-wNbGF6x4B1)