From the course: Using Slack and AWS EventBridge to Automate Your DevOps Tasks
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: HTTP POST to the Slack API - Amazon Web Services (AWS) Tutorial
From the course: Using Slack and AWS EventBridge to Automate Your DevOps Tasks
Solution: HTTP POST to the Slack API
(upbeat music) - Here we have my solution to this challenge. Let's go over, line by line. So line one says import json, which is the package for Python to handle and process json documents. Line two is the import requests package, which is the one that I'm importing for the purpose of being able to do an HTTP post request, which we need in this case. It says from botocore.vendored import requests. This is some slight AWS variants, you wouldn't do this doing desktop Python code, but in here, it's kind of required to do the from botocore.vendor to be able to get this particular package. Line seven is the token that we got from the permission section of our application. Line eight is the URL that we got from the documentation that says, "Hey, if you want to post a message call this URL, which is slack.com/api postMessage. Now from lines 10 through 13 is where actually create the json document that I want to send,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.