import urllib3
import json


def post_to_slack_channel (auth_token, message, channel):
    """
    Post message `message` to Slack channel `channel`.
    """

    answer_payload = {"text": message, "channel": channel}

    urllib3.disable_warnings()
    http = urllib3.PoolManager()
    encoded_data = json.dumps(answer_payload).encode('utf-8')
    bot_token = f"Bearer {auth_token}"
    
    r = http.request(
      'POST',
      'https://slack.com/api/chat.postMessage',
      body = encoded_data,
      headers={'Content-Type': 'application/json', 'Authorization' : bot_token }
    )
    
    return(r)