How can I store and read variables in automations/scripts?

So I wanna build a NFC jukebox. I know there is a sample automation for this out there, but since I don’t quite understand it and want to do more in my automation I’m trying to make my own automation, or maybe a script executed by an automation is better.

I have 10 NFC tags in HA. I want to connect a Spotify URL to each card.
When a card is read, the automation should get url associated with that tag id.
So, somewhere I want to create a file to include that looks like:

tag_id: 32132klkldsa-fdkjsjdfk-323kcl
url: https://open.spotify.com/album/64ajGmREHmimBC99OAFfhB?si=IQPfukFvRMKIkUDvPcTwUA&dl_branch=1
type: playlist

So when the tag is read, I want to use a variable to send to media_player.play_media (url and type) to the automation.

Where do I start?

I would do something like this:

play_spotify:
  variables:
    mapping: >-
      {{
        {
        "tag1": ["url1", "type1"],
        "tag2": ["url2", "type2"]
        }
      }}
  sequence:
    - data:
        message: "url {{ mapping[tag][0] }} type {{ mapping[tag][1] }}"
      service: persistent_notification.create

Fill in the tag ID, url, and type for each tag and modify the sequence as needed. Call it with:

service: script.play_spotify
data:
  tag: tag1

Great, thanks!

I forgot that you can use YAML in variable definitions, so this may be a bit more user-friendly:

play_spotify:
  variables:
    mapping:
      tag1:
        url: url1
        type: type1
      tag2:
        url: url2
        type: type2
  sequence:
    - data:
        message: "url {{ mapping[tag]['url'] }} type {{ mapping[tag]['type'] }}"
      service: persistent_notification.create