Update the PANDIUM.yaml
Update the PANDIUM.yaml for “Pokémon of the Day” to add dynamic pokemon_type and slack_user configs whose options come from tenant metadata, so tenants can customize messages.
This is where you will start to set up the functionality that allows a user to choose which type of Pokémon they will learn about and who will receive the daily Slack message.
One of the PANDIUM.yaml's key purposes is to populate the Connections Settings page. That page allows users to customize how their tenant will run.
At the moment the PANDIUM.yaml in your Pokémon of the Day integration does not have any configurations, but the Academy has asked for these dynamic configs to be added: pokemon_type and slack_user
Add
configswith itsschemaanduischemato your PANDIUM.yaml, above themetadata_schema, so it looks like this:
version: 1.0
base: node:24
build: npm install --production && npm i --save-dev @types/node && npm run build
run: node .
configs:
schema:
type: object
required:
properties:
uischema:
type: VerticalLayout
elements:
metadata_schema:
schema:
name: metadata_schema
properties:
last_pokemon_id:
type: numberUnder
schemapropertiesadd the following:
On manifest version 1.0 the options for a dynamic config come from the tenant's metadata. The $ref for each of these properties points at a metadata key, so the pokemon_type config will have a dropdown menu on the Connections Settings page filled with whatever is in the tenant's pokemon_types metadata.
Every metadata key referenced this way has to be declared in the metadata_schema, so let's add pokemon_types and slack_users next to the last_pokemon_id from Part 1.
Make the
metadata_schemapropertieslook like this:
An array of strings in metadata becomes a plain list of options, while an array of const and title objects becomes a list where the title is displayed and the const is what the integration receives.
When you built the first iteration of the integration you saw that Pandium saves the standard out of a successful normal sync to the tenant's metadata. Pandium does the same with the standard out of a successful init sync, and merges it into the metadata that is already there.
When you add the init sync flow you will end it by printing a standard out which will look something like this:
Pandium will validate that standard out against the metadata_schema, save it to the tenant's metadata, and read the two lists from there when displaying the Connections Settings page.
You can read more about using metadata to populate dynamic configs here.
Under
schemarequiredaddpokemon_typeandslack_user.Add this
Sectionelement to theuischemaelements:
Your PANDIUM.yaml should now look like the one here.
Run
pandium local preview-configsto check your work before you push it. The form in your browser should show the Configure Pokémon of the Day section with its subtitle and the two new controls. Try editing a label in the PANDIUM.yaml and saving; the preview reloads with your change.
The preview is built from the file alone, so it has no tenant metadata to fill the dropdowns from. Let's take a look at how the connection settings page looks on the Integration Hub with this updated PANDIUM.yaml!
Last updated
Was this helpful?