Hype uses fixed height and position. So if you have a string you can layout your box to your needs in the GUI while creating it.
If you want to use a dynamic string you are already using JS to replace content so you would need to also change the height of the modal box by script. Use the command hypeDocument.setElementProperty and set height base on content length.
A hint to avoid positioning the button. Use a group for sizing everything and use the stretch an positioning pins for the elements inside the group like the button (bottom, center) and background (edge to edge pinned).