Create dynamic Tag Group at topic level?

There is this code I found that can create tags uskng code:

You could make an API call to get the topic’s poster, which will be the company’s name.

The trickier bit is adding the tag to the tag group. I don’t see a way to this this programmatically as of now…