title: How to send log files from AWS to Microsoft teams with Lambda Function
body: <p>I have a scenario where I need to have a Lambda function that can pick AWS CodeBuild Logs, bundle it up into a json or txt and send this json to a particular Channel in MS teams as a file. I don't want to clutter the channel by sending the logs as inline message but as a logfile that folks in other team can download.
  I have the Hook_URL for the channel.
  I have been able to get this working with the below code:-</p>
  
  <pre><code>def lambda_handler(event, context):
    json_payload = {'text' : 'hello world'}
    req = requests.post(HOOK_URL, json=json_payload)
  </code></pre>
  
  <p>This works and I get a text message as "hello world" in the channel.
  but when I run the below code:-</p>
  
  <pre><code>def lambda_handler(event, context):
    files = {'file': open('/tmp/logs.txt', 'rb')}
    json_payload = {'text' : 'hello world'}
    req = requests.post(HOOK_URL, files=files)
  </code></pre>
  
  <p>I don't see any files getting uploaded to MS teams.Don't worry about the file handle. I have not included the code to write into the file but the file is present with log content in "/tmp/logs.txt"</p>
  
  <p>Please advise.</p>