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.

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@company.kz",
      "availability": "online"
    },
    "new_role": "admin",
    "previous_role": "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@company.kz",
      "availability": "online"
    },
    "new_role": "admin",
    "previous_role": "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, e.g. `admin`, `manager`, or `agent`
previous_rolestring|nullThe member's role before the change; `null` if they had none
sourcestringWho changed the role: `company` — a company administrator in the AISAR dashboard; `partner` — the partner that serves the company