developers.wazo.io

import PageHeader from ‘@site/src/components/PageHeader’;

Documentation

Portal plugins allow many great ways to extend the interface. Here’s a quick summary, scroll down for more information.

Tabs - Add a panel on stack’s dashboard

App configuration (small

To create a new tab in the PBX main screen, add a staticTabs in your manifest with a generalPbxTab context :

"staticTabs": [
  {
    "entityId": "my id",
    "context": [
      "generalPbxTab"
    ],
    "name": "My label",
    "contentUrl": "./content.html"
  }
],

When the user clicks on the tab, the contentUrl will be loaded.

App configuration (small

To create a new page the PBX menu, add a staticTabs in your manifest with a pbxMenu context :

"staticTabs": [
  {
    "entityId": "my id",
    "context": [
      "pbxMenu"
    ],
    "name": "My label",
    "parent": "common.layout.pbxMenu.userManagement",
    "contentUrl": "./content.html"
  }
],

The parent key can be one of common.layout.pbxMenu.* where * is : globalSettings, userManagement, callManagement, services, callCenter,reporting, soundsAndGreetings, settings.

When the user clicks on the tab, the contentUrl will be loaded.

Tabs - Add a new menu

App configuration (small)

To create a new menu in the PBX section, add a staticTabs in your manifest with a pbxMenu context :

"staticTabs": [
  {
    "entityId": "custom-child",
    "context": [
      "pbxMenu"
    ],
    "name": "New child",
    "parent": "New menu",
    "parentIcon": "AccountBalance",
    "contentUrl": "http://example.com/stats-stack.html"
  },
  {
    "entityId": "custom-child2",
    "context": [
      "pbxMenu"
    ],
    "name": "New child 2",
    "parent": "New menu",
    "parentIcon": "AccountBalance",
    "contentUrl": "http://example.com/stats-stack.html"
  },
],

When the user clicks on the tab, the contentUrl will be loaded.

App configuration (small

To create a new menu in the PBX section, add a staticTabs in your manifest with a globalSettings context :

"staticTabs": [
  {
    "entityId": "global-settings",
    "context": [
      "globalSettings"
    ],
    "name": "Custom global",
    "icon": "BrightnessHigh",
    "contentUrl": "http://localhost:3002/portal/global.html"
  }
],

When the user clicks on the tab, the contentUrl will be loaded.

Tabs - Extend an existing form

App configuration

To create a new tab in the PBX main screen, add a staticTabs in your manifest with a pbx.* context :

"staticTabs": [
  {
    "entityId": "my id",
    "context": [
      "pbx.users"
    ],
    "name": "My label",
    "contentUrl": "./content.html"
  }
],

The context key can be one of pbx.* where * is : users, lines, devices, ring-groups, voicemails, …

When the user clicks on the tab, the contentUrl will be loaded.

Sometimes we may want to open a link in a new tab. To change the behavior of the static tab, add "isExternal": true to the staticTab definition.

"staticTabs": [
  {
    "entityId": "support-tab",
    "context": [
      "pbxMenu",
      "globalSettings"
    ],
    "name": "Support",
    "contentUrl": "https://support.wazo.io/",
    "icon": "./assets/icon.svg",
    "isExternal": true,
  }
],

:::info isExternal will work only with a staticTab of type: “pbxMenu” and “globalSettings” :::

To defined icon and parentIcon image, we support two types of values:

  1. Path to a black .svg icon (recommended)
  2. Using a supported Material UI icon

    List of supported icons - `Accessibility` - `AccountBalance` - `AccountBox` - `AccountCircle` - `Add` - `AddCircleOutline` - `AddIcCallOutlined` - `AndroidSharp` - `Apps` - `AppSettingsAlt` - `ArrowBack` - `ArrowDownward` - `ArrowDropDown` - `ArrowForward` - `ArrowForwardIos` - `ArrowUpward` - `Block` - `Bolt` - `BrightnessHigh` - `BugReport` - `Build` - `Business` - `BusinessOutlined` - `CakeOutlined` - `CalendarMonth` - `Call` - `CallEnd` - `CallMerge` - `Cancel` - `CancelOutlined` - `Check` - `CheckCircle` - `CheckCircleOutline` - `CheckCircleOutlined` - `ChevronLeft` - `ChevronRight` - `Clear` - `Close` - `Cloud` - `CloudDownload` - `Dashboard` - `DateRange` - `DateRangeOutlined` - `Delete` - `DeleteOutline` - `Description` - `DesktopMac` - `DesktopWindowsOutlined` - `DeviceHub` - `DialerSip` - `Dialpad` - `DirectionsCar` - `Done` - `DoneAll` - `DoneOutlined` - `DragHandle` - `Edit` - `Email` - `EmailOutlined` - `Equalizer` - `Error` - `ErrorOutline` - `EventSeat` - `ExitToApp` - `ExpandLess` - `ExpandMore` - `Extension` - `FileCopyOutlined` - `FilterList` - `FilterTiltShift` - `Flag` - `FlashOn` - `FolderShared` - `FormatListBulleted` - `GetApp` - `Group` - `GroupOutlined` - `HeadsetMic` - `Help` - `HelpOutline` - `History` - `Info` - `InfoOutlined` - `InsertChart` - `InsertDriveFile` - `Key` - `KeyboardArrowLeft` - `KeyboardArrowRight` - `KeyboardReturn` - `Laptop` - `Launch` - `LibraryBooks` - `LibraryMusic` - `List` - `LocationOn` - `LocationOnOutlined` - `Lock` - `LockOutlined` - `Menu` - `MonitorHeart` - `MoreHoriz` - `MoreVert` - `MusicNote` - `NavigateNext` - `NoteOutlined` - `NotificationsNone` - `OpenInNew` - `People` - `PermDataSetting` - `Person` - `PersonOutlined` - `Phone` - `PhoneForwarded` - `PhoneOutlined` - `PieChart` - `PlayArrow` - `PlaylistAdd` - `Public` - `Publish` - `QueryBuilder` - `Receipt` - `ReceiptOutlined` - `RecordVoiceOver` - `Redo` - `Refresh` - `Remove` - `Restore` - `RingVolume` - `RoomService` - `Schedule` - `ScheduleOutlined` - `Search` - `Send` - `Settings` - `SettingsApplications` - `SettingsBackupRestore` - `SettingsPhone` - `Shuffle` - `SignalCellular4Bar` - `Smartphone` - `SmartphoneOutlined` - `Sms` - `Speaker` - `Star` - `Stop` - `Storage` - `StoreMallDirectory` - `SupervisorAccount` - `SwapCalls` - `Sync` - `Timeline` - `Toc` - `Today` - `Transform` - `TrendingFlat` - `Troubleshoot` - `TtyOutlined` - `Tune` - `Update` - `VerifiedUser` - `ViewList` - `Visibility` - `VisibilityOff` - `Voicemail` - `VolumeDown` - `VolumeMute` - `VolumeUp` - `VpnKey` - `VpnLock` - `Warning` - `Web` - `WebAsset`

Context - Plugin Extra Payload

Portal plugins receive extra context via app.getContext().app.extra once app.initialize() resolves. You can use it to call portal/stack APIs or render administrator-specific UI without making extra round trips.

await app.initialize();
const { extra } = app.getContext().app;
Field Description
extra.clientType Always 'portal' for Portal plugins.
extra.portal.host Hostname of the portal API (nestbox), e.g. 127.0.0.1:8842. Use it to call portal endpoints like https://${host}/api/confd/1.0/resellers.
extra.portal.tenant UUID of the currently-selected portal tenant (matches localStorage.currentTenantUuid / the toolbar AccountSwitcher).
extra.administrator.uuid UUID of the connected administrator.
extra.administrator.username Username of the connected administrator.
extra.administrator.organization.resource Account type: resellers, customers or locations.
extra.administrator.organization.is_partner true when the account is a partner.
extra.administrator.organization.uuid / .name UUID and name of the administrator’s organization.
extra.stack.host / extra.stack.port Hostname and port of the connected stack. Use it to call stack endpoints like https://${host}:${port}/api/auth/0.1/tenants.
extra.stack.session.token Auth token for the connected stack.
extra.stack.currentTenant UUID of the currently-selected stack tenant.
extra.stack.wazoUuid / extra.stack.version Stack identification and engine version.

:::info extra.stack is only populated when the plugin tab is mounted in a pbxMenu context (i.e. after the user has connected to a stack). :::

Security - Administrator role

Sometimes, you may want to prevent an administrator from modifying sensitive information on a plugin page. From context, you can retrieve the current user’s account type and then handle the right logic.

await app.initialize();
const context = app.getContext();

const accountType = context.extra.administrator.organization.resource;
switch (accountType) {
  case: 'resellers':
    return true;

  case: 'customers':
  case: 'locations':
  default:
    return false;
}

Background Script

You can add custom code when the user is not using a custom tab. It can be useful to handle custom events.

{
  // ...
  "backgroundScript": "./background.js"
}

Please refer to the SDK documentation to know how to inject custom code in the application.

The background script is always running, even when the user is logged out. Please make sure to remove all related background tasks when the onLogout listener event is fired.