Skip to content
AISARAISAR
Users & team

Users & team

User role changed

user.role_changed

Fires when a company member is given a different role — either by a company administrator in the dashboard or by the partner that serves the company. The event is sent only when the role actually changes: re-assigning the same role produces no event (since 2026-09-29; before that the event was sent on every save, including no-op ones, and carried neither `previous_role` nor `source`). The `new_role` field is unchanged. The role may be a system one (`admin`, `manager`, `agent`) or a custom one (`custom:<ulid>`); `new_role_name` and `previous_role_name` carry the human-readable title. The event also reaches every member who was moved to another role when a custom role was deleted (`source: "role_deleted"`).

HTTP request

AISAR sends a signed POST request to your webhook_url:

http
POST {webhook_url}
Content-Type: application/json
X-AISAR-Signature: sha256=...

{
  "event": "user.role_changed",
  "event_id": "evt_01JXXXXXXXXXXXXXXXXXXXXX",
  "timestamp": "2026-09-29T12:00:00.000000Z",
  "company_id": 1,
  "data": {
    "user": {
      "id": 55,
      "name": "Aliya Seitova",
      "email": "aliya@example.com",
      "availability": "online"
    },
    "new_role": "admin",
    "new_role_name": "Admin",
    "previous_role": "agent",
    "previous_role_name": "Agent",
    "source": "company"
  }
}

The X-AISAR-Signature header carries an HMAC-SHA256 signature of the request body — use it to verify the request came from AISAR.

Example payload

json
{
  "event": "user.role_changed",
  "event_id": "evt_01JXXXXXXXXXXXXXXXXXXXXX",
  "timestamp": "2026-09-29T12:00:00.000000Z",
  "company_id": 1,
  "data": {
    "user": {
      "id": 55,
      "name": "Aliya Seitova",
      "email": "aliya@example.com",
      "availability": "online"
    },
    "new_role": "admin",
    "new_role_name": "Admin",
    "previous_role": "agent",
    "previous_role_name": "Agent",
    "source": "company"
  }
}

Payload fields

FieldTypeDescription
user.idintegerID of the member whose role changed
user.namestringFull name (first + last combined)
user.emailstringUser email
user.availabilitystring|nullCurrent availability status: `online`, `away`, `offline`, or `busy`
new_rolestringThe role now assigned to the member: `admin`, `manager`, `agent`, or a custom role key `custom:<ulid>`
previous_rolestring|nullThe member's role before the change; `null` if they had none
new_role_namestringTitle of the assigned role: `Admin`, `Manager`, `Agent` for system roles, or the given title of a custom role
previous_role_namestring|nullTitle of the previous role; `null` if there was none
sourcestringWho changed the role: `company` — a company administrator in the AISAR dashboard; `partner` — the partner that serves the company; `role_deleted` — an administrator deleted a custom role and the member was moved to the replacement