"Homey.flowToken.getFlowTokens()" no longer works with the new homey-api

I often create variables with the function tag, example:

await tag('Group_1_test_1', '-')
await tag('Group_1_test_2', '-')
await tag('Group_1_test_3', '-')

I read them again with the script below:

let flowTokens = await Homey.flowToken.getFlowTokens();

for (const flowToken of Object.values(flowTokens)) {
  if (flowToken.uri == 'homey:app:com.athom.homeyscript'  
      && flowToken.title.startsWith('Group_1') ) {

Output the classic version of the script

This script has been marked as “Classic”, “Deprecated API version” for several months now.
When I create a new script, I get the following error message as output:
TypeError: Cannot read properties of undefined (reading ‘getFlowTokens’)

From the description of Tutorial: Migrating deprecated scripts - HomeyScript it is not clear to me what exactly I need to adjust.
Does anyone know what exactly I need to adjust to read the tags again?


Hi Robert, Thank you for your quick response.