How to retrieve a Slack UserID from known Username in Javascript

I am trying to create a button in Javascript that will link me to a dm in Slack with a specific user. I am just learning about API and GET methods and cannot figure out how to find the Slack UserID from a known Username.

Here is the button I am trying to create. But I am unable to find the UserID using the UserName.

//Have UserName
var = userName

// Get UserID using UserName
let btn = document.createElement("button")
    btn.innerHTML = "Slack Button"

//Button redirecting to Slack DM with specific user
btn.onclick = function(){
        window.open((slackUrlLink).append(UserID));
}