Yes,this can be done. Instead of “#channel_name” use “@user” in the API. The user will receive the message from slackbot as we are using API and not a direct message from any other user. And if you want to post to that user as the authenticated user, use as_user= true
.
slack.chat.post_message('@to_user',msg,username="@from_user")
More details are at https://api.slack.com/methods/chat.postMessage