> For the complete documentation index, see [llms.txt](https://docs.digitalsamba.com/reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalsamba.com/reference/sdk/events/rolechanged.md).

# roleChanged

Emitted when a role of a user changes. This can be useful if you have a custom participants panel and want to display up-to-date roles or you just want to react to a role change.

#### Sample payload

```json
{
  "type": "roleChanged",
  "data": {
      "userId": "2775f882-845e-4416-82c9-04cc25669c0b",
      "from": "attendee",
      "to": "moderator"
    }
  }
}
```

#### Sample subscription code

```javascript
sambaFrame.on('roleChanged', (event) => {
  const data = event.data;
  console.log('User', data.userId, 'role changed from', data.from, 'to', data.to);
});
```

{% hint style="info" %}
This event is often used with the [changeRole](/reference/sdk/methods/changerole.md) method.
{% endhint %}
