In the config object of your tenant's most recent normal sync logs you should have seen your Slack user ID. Replace the Slack user ID above with your own.
Fetch the selected Pokémon type by doing the following:
The pokemonSync.ts file should look something like this:
You should get a Pokémon Slack message, but we're more interested in examining the logs; they should look something like this:
> pokemon-of-the-day@1.0.0 start
> node build/src/
This run is in mode: normal
------------------------CONFIG------------------------
Config { pokemon_type: 'rock', slack_user: '<YOUR-SLACK-MEMBER-ID>' }
------------------------CONTEXT------------------------
Context {
run_mode: 'normal',
last_successful_run_std_out: '{"last_pokemon_id":247}'
}
------------------------POKEMON SYNC------------------------
{
damage_relations: {... various damage relations properties of the rock Pokémon type}
... more properties of the rock Pokémon type
}
{"last_pokemon_id":248}
You'll see that each Pokémon type has the property pokemon; it's an array of the type's Pokémon. We should select the Pokémon of the day from that list!
Each member of the pokemon array has the following shape:
Change how nextPokemonId is defined; it should be the ID of the first member of the fetched type's pokemon array whose ID is greater than lastPokemonId.
Unless you changed the standard out in your .env this run's results may not look too different from the last run's (except the logs won't include the Pokémon type). This is because the list of Pokémon within a type often has many Pokémon of consecutive IDs . Regardless, you have shown that the new method of defining nextPokemonId does not interfere with the rest of the flow's functionality.
Now adjust pokemonSync to use the slack_user config
Once again, this run's results may not look too different from the last run's. This shows that accessing the slack User's ID from config, instead of a hardcoded list does not interfere with the rest of the flow's functionality.
Your pokemonSync.ts should match this one. In fact your integration files should match all the ones in this repository.
The final step is to see what this all looks like when it is run on Pandium!