Admin Resources
此内容尚不支持你的语言。
This page documents backend platform-management resources: role- and permission-based access control, home banners for in-app announcements, a media library for uploaded assets, and a per-user notification system. These are relevant mainly if you’re building deeper admin/dashboard tooling on top of Wetel — see Admin API Overview for the broader admin surface. If you’re only integrating a runtime agent (starting sessions, sending messages), you likely don’t need this page — see API Reference Overview for the full index.
Every request must include the x-huat-platform: customer header, and every operation on this page requires a JWT (Authorization: Bearer <token>), obtained via login. None of these operations accept an API key.
Roles & Permissions
Section titled “Roles & Permissions”Roles are named groups of permission slugs, used to control which portal/admin operations a user can perform. RoleEntity and PermissionEntity are landlord-level (not filtered by tenant row-by-row), but every mutation still requires an authenticated, tenant-resolved caller.
getAllPermissions
Section titled “getAllPermissions”Returns every active Permission.
Auth required: JWT.
Arguments: None.
Returns: [Permission!]!
| Field | Type | Notes |
|---|---|---|
id | Int! | |
name | String! | |
slug | String! | Kebab-case, e.g. create-agent. Used in CreateOneRoleInput.slugs/UpdateRoleInput.slugs |
module | ModuleType! | HOME_BANNER, NOTIFICATION, PERMISSION, PORTAL_USER, ROLE, TENANT, or USER |
description | String | |
createdAt / updatedAt | DateTime! |
query GetAllPermissions { getAllPermissions { id slug module }}getPermission
Section titled “getPermission”Fetches a single Permission by id.
Auth required: JWT.
Arguments:
| Argument | Type | Required |
|---|---|---|
id | Int! | Yes |
Returns: Permission! (see shape above)
getPermissions
Section titled “getPermissions”Lists permissions, filterable/sortable (no pagination — this is a small, complete list, not a Relay connection).
Auth required: JWT.
Arguments:
| Argument | Type | Default |
|---|---|---|
filter | PermissionFilter! | {} |
sorting | [PermissionSort!]! | [] |
PermissionFilter supports id, slug, module, createdAt, updatedAt, plus and/or composition — standard comparison operators (eq, in, like, etc.) per field.
Returns: [Permission!]!
getPortalRole / getPortalRoles
Section titled “getPortalRole / getPortalRoles”Fetches one role or a paginated list of roles. Despite the Portal naming, these live on the main API and are gated by a regular JWT — they are the admin/portal-side access-control surface, not part of the customer-facing agent/session schema.
Auth required: JWT.
getPortalRole arguments: id: Int! → returns Role!.
getPortalRoles arguments:
| Argument | Type | Default |
|---|---|---|
filter | RoleFilter! | {} |
paging | OffsetPaging! | { limit: 10 } |
sorting | [RoleSort!]! | [] |
Returns RoleConnection! — { nodes: [Role!]!, pageInfo: OffsetPageInfo!, totalCount: Int! } (offset pagination — pass { limit, offset } in paging, not a cursor).
Role fields:
| Field | Type | Notes |
|---|---|---|
id | Int! | |
name | String! | |
description | String | |
permissions | [Permission!] | Accepts its own nested filter/sorting args |
totalPortalUser | Int | Reserved for a separate admin-portal service; always 0 from this API |
createdAt / updatedAt | DateTime! |
createOneRole
Section titled “createOneRole”Creates a role from a set of permission slugs.
Auth required: JWT.
Arguments:
| Argument | Type | Required |
|---|---|---|
input | CreateOneRoleInput! | Yes |
CreateOneRoleInput:
| Field | Type | Notes |
|---|---|---|
name | String! | |
description | String! | |
slugs | [String!]! | Must resolve to at least one existing Permission, or the mutation throws |
Returns: Role!
mutation CreateOneRole($input: CreateOneRoleInput!) { createOneRole(input: $input) { id name permissions { slug } }}{ "input": { "name": "Support Lead", "description": "Manage banners and notifications", "slugs": ["view-home-banner", "delete-home-banner"] }}updateOneRole
Section titled “updateOneRole”Auth required: JWT.
Arguments:
| Argument | Type | Required |
|---|---|---|
input | UpdateOneRoleInput! | Yes |
UpdateOneRoleInput: { id: Int!, update: UpdateRoleInput! }. UpdateRoleInput fields (name, description, slugs) are all optional — send only what is changing. If slugs is provided it replaces the role’s permission set entirely and must resolve to at least one existing permission.
Returns: Role!
deleteOneRole
Section titled “deleteOneRole”Soft-deletes a role.
Auth required: JWT.
Arguments: id: Int!
Returns: Boolean!
mutation DeleteOneRole($id: Int!) { deleteOneRole(id: $id)}Home Banners
Section titled “Home Banners”Home banners are scheduled announcements shown in-app. There are two separate read surfaces:
getHomeBanners
Section titled “getHomeBanners”Auth required: None beyond the standard platform header — this is intentionally a public, unauthenticated read.
Arguments:
| Argument | Type | Default |
|---|---|---|
filter | HomeBannerFilter! | {} |
paging | OffsetPaging! | { limit: 10 } |
sorting | [HomeBannerSort!]! | [{ direction: DESC, field: createdAt }] (server also always applies a priority: ASC sort ahead of your filter) |
Returns: HomeBannerOffsetConnection! — { nodes: [HomeBanner!]!, pageInfo: OffsetPageInfo!, totalCount: Int! }
HomeBanner fields:
| Field | Type | Notes |
|---|---|---|
id | Int! | |
title | String! | |
description | String! | |
actions | String! | |
url | String! | |
isInternalLink | Boolean! | |
priority | Float! | Lower sorts first |
status | GeneralStatusType! | DRAFT or PUBLISHED |
startDate / endDate | DateTime | |
image / mobileImage | MediaLibrary | Nullable — resolved from the stored imageId/mobileImageId |
createdAt / updatedAt | DateTime! |
getPortalHomeBanner / getPortalHomeBanners
Section titled “getPortalHomeBanner / getPortalHomeBanners”Admin-side equivalents of the above, including unpublished and out-of-window banners. Same HomeBanner shape.
Auth required: JWT, with the HOME_BANNER / VIEW access-control permission.
getPortalHomeBanner arguments: id: Int! → returns HomeBanner!.
getPortalHomeBanners arguments: same shape as getHomeBanners (filter, paging, sorting, default sort [] — no forced ordering). Returns HomeBannerConnection!.
createOneHomeBanner
Section titled “createOneHomeBanner”Auth required: JWT, with the HOME_BANNER / CREATE permission.
Arguments:
| Argument | Type | Required |
|---|---|---|
input | CreateHomeBannerInput! | Yes |
CreateHomeBannerInput:
| Field | Type | Notes |
|---|---|---|
title | String! | |
description | String | |
actions | String! | |
url | String | |
isInternalLink | Boolean! | |
priority | Float! | |
status | GeneralStatusType | DRAFT or PUBLISHED |
startDate / endDate | DateTime! | Required — both bound the banner’s active window |
image | ImageInput! | Required — { filename: String!, filesize: Float!, mimeType: String!, url: String!, sequence: Float = 0 } |
mobileImage | ImageInput | Optional |
Returns: HomeBanner!
updateOneHomeBanner
Section titled “updateOneHomeBanner”Auth required: JWT, with the HOME_BANNER / UPDATE permission.
Arguments: input: UpdateOneHomeBannerInput! — { id: Float!, update: UpdateHomeBannerInput! }. Every field on UpdateHomeBannerInput is optional (same field set as CreateHomeBannerInput, minus the ! required markers) — send only what is changing.
Returns: HomeBanner!
deleteOneHomeBanner
Section titled “deleteOneHomeBanner”Soft-deletes a banner.
Auth required: JWT, with the HOME_BANNER / DELETE permission.
Arguments: input: DeleteOneHomeBannerInput! — { id: Int! }.
Returns: HomeBannerDeleteResponse! — a mirror of HomeBanner’s scalar fields (all nullable), reflecting the just-deleted record’s last state.
mutation DeleteOneHomeBanner($input: DeleteOneHomeBannerInput!) { deleteOneHomeBanner(input: $input) { id title }}Media Library
Section titled “Media Library”A per-tenant catalog of uploaded assets (images, documents, videos) — mainly used as the backing store for home banner images.
getMediaLibrary
Section titled “getMediaLibrary”Fetches a single asset by id.
Auth required: JWT.
Arguments: id: Int (optional in the schema, but omitting it throws a BadRequestException — always pass it in practice).
Returns: MediaLibrary!
| Field | Type | Notes |
|---|---|---|
id | Int! | |
filename | String! | |
filesize | Float! | |
mimeType | String! | |
type | MediaType! | IMAGE, DOCUMENT, or VIDEO |
path | String! | Stored object path |
url | String | Playable/downloadable URL derived from path; null for unrecognized media types |
thumbnail | String | |
extra | JSON | |
createdAt / updatedAt | DateTime! |
getMediaLibrarys
Section titled “getMediaLibrarys”Lists media assets for the caller’s tenant.
Auth required: JWT.
Arguments:
| Argument | Type | Default |
|---|---|---|
filter | MediaLibraryFilter! | {} |
paging | OffsetPaging! | { limit: 10 } |
sorting | [MediaLibrarySort!]! | [{ direction: DESC, field: createdAt }] |
MediaLibraryFilter supports id, filename, type, createdAt, updatedAt.
Returns: MediaLibraryOffsetConnection! — { nodes: [MediaLibrary!]!, pageInfo: OffsetPageInfo!, totalCount: Int! }
Notifications
Section titled “Notifications”Per-user, internal-source notifications (the NotificationSourceType.INTERNAL scope — this API does not surface externally-sourced notification records, if any exist).
getNotifications
Section titled “getNotifications”Auth required: JWT. Always scoped to the calling user (userId is forced from the JWT, not client-suppliable via filter).
Arguments:
| Argument | Type | Default |
|---|---|---|
filter | NotificationFilter! | {} |
paging | OffsetPaging! | { limit: 10 } |
sorting | [NotificationSort!]! | [{ direction: DESC, field: createdAt }] |
Returns: NotificationOffsetConnection! — { nodes: [Notification!]!, pageInfo: OffsetPageInfo!, totalCount: Int! }
Notification fields:
| Field | Type | Notes |
|---|---|---|
id | Int! | |
title | String! | |
message | String! | |
type | NotificationType! | REMINDER, SUCCESS, or WARNING |
hasRead | Boolean! | |
meta | JSONObject! | Arbitrary structured payload, shape depends on type |
userId | Float! | |
createdAt / updatedAt | DateTime! |
getUnreadNotificationsCount
Section titled “getUnreadNotificationsCount”Auth required: JWT.
Arguments: None.
Returns: Float! — count of unread, internal-source notifications for the caller.
query UnreadCount { getUnreadNotificationsCount}markAsRead
Section titled “markAsRead”Marks a single notification as read. Filters by both id and the caller’s userId — you cannot mark another user’s notification as read.
Auth required: JWT.
Arguments: id: Int (optional in the schema; pass a real id in practice).
Returns: Boolean!
markAllAsRead
Section titled “markAllAsRead”Marks every internal-source notification belonging to the caller as read.
Auth required: JWT.
Arguments: None.
Returns: Boolean!
mutation MarkAllAsRead { markAllAsRead}For the broader admin surface this page is part of, see Admin API Overview. For the full GraphQL operation index, see API Reference Overview.