how can I embed text in svg server side

How can I embed a text into SVG in NodeJS? The context is that I have a ticket in SVG and in response to a webhook the Netlify function is called, and I need to embed the name in the ticket, convert it to PDF and send it. With conversion to PDF I know I need to use PDFmake, however I don’t know how to embed the name in the correct place in the ticket (which has ID). The only idea that comes to my mind is to paste the SVG code directly in the file as a string literal and embed the name in there. The code of a ticket is huge, tho, and it’s going to be a mess. Any ideas please?
Thanks