text: import azure.functions as func
  from datetime import datetime, timedelta
  import logging
  import requests
  from urllib.parse import unquote 
  
  # webhook generated by Teams
  WEBEX_WEBHOOK_URL = 'https://api.ciscospark.com/v1/webhooks/incoming/YourWebHookHere'
  
  def main(req: func.HttpRequest) -> func.HttpResponse:
      try:
          # log the encoded message
          logging.info(f"Encoded body: {req.get_body()}")
          # decode hex values
          message = unquote(req.get_body().decode())
          # log the decoded message
          logging.info(f"Decoded body: {message}")
          # split the message at markdown= or text=
          content_type, message = message.split('=', 1)
          # split the message at the timestamp
          time_stamp, message = message.split('|')
          # remove extraneous white space characters from the timestamp
          time_stamp = time_stamp.replace("+", " ")
          # convert the message from a string to a datetime object
          time_stamp = datetime.strptime(time_stamp.strip(), '%m/%d/%Y %I:%M:%S %p')
          # convert from UTC to EST
          time_stamp = time_stamp - timedelta(hours=4)
          # assemble the final message
          message = f"{content_type}={time_stamp.strftime('%m/%d/%Y %I:%M:%S %p')} | {message.strip()}"
          # correct space formatting
          message = message.replace(" ", "+")
          # Teams does not support em dash characters in webhooks
          message = message.replace("—", "--")
          # Teams does not support % characters in webhooks
          message = message.replace("%", "percent")
          # Teams does not support ° characters in webhooks
          message = message.replace("°", "degress ")
          # PRTG converts '<' to '{' so revert
          message = message.replace("{", "<")
          # PRTG converts '>' to '}' so revert
          message = message.replace("}", ">")
          # log the final message
          logging.info(f"Final body: {message}")
          if message:
              post = requests.post(
                  WEBEX_WEBHOOK_URL, data=message.encode('utf-8'),
                  headers={'Content-Type': 'application/x-www-form-urlencoded'}
              )
              return func.HttpResponse(post.reason, status_code=post.status_code)
      except Exception as e:
          # log the exception
          logging.info(f"Error: {e}")
          # log the final message for debugging
          logging.info(f"Final body: {message}")
  