#100DaysOfWeb in Python Transcripts
Chapter: Days 77-80: Twitter and Slack bots
Lecture: Testing out the slash command with ngrok

Login or purchase this course to watch this video and the rest of the course contents.
0:00 First I need to run my Flask app. And as per the Flask documentation site the way to do that is flask app=book.py flask run
0:20 But let's make sure we run it in debug mode to catch potential errors.
0:37 And now debug mode is on. Now, I cannot hit this local URL from the internet. So let's use Ngrok to expose this to the internet. Let's go to ngrok.com
0:49 and download this utility.
1:14 And let's run it and the only thing we need is HTTP and we need to match the port of the Flask app which is 5000.
1:28 And here we see our temporarily internet address that's mapped to our localhost 5000 which is our Flask app.
1:41 And this is probably good news, it's not a 404. This is saying, doing a GET where we only setup a POST for that reld. So let's try directly from Slack.
1:53 First I need to go back to my slash command and setup the new endpoint. And I can go to Slack and see if it works.
2:10 That's good. Wow, look at that. Here is my app. Here is my message. Here is my link which links to the URL we specified
2:23 in the attachments. So I can click here and it indeed goes to the page of the book. The author formatted in italics pages and the picture of the book
2:36 which makes it really look nice. And that's all there is to it. So of course when we stop this server it's not going to work any more.
2:44 At this point you would deploy it to a server. And again change this slash command to point to that server and have it running permanently.
2:57 Run it again, we should get another book. Great. This is a really great book by the way. All right I hope you enjoyed this, and again
3:10 this was all the code to get a slash command running. It's pretty amazing. All right this wraps up the videos for today and tomorrow you're going to
3:19 build your own Slack tool. Right see you then.


Talk Python's Mastodon Michael Kennedy's Mastodon