#100DaysOfWeb in Python Transcripts
Chapter: Days 77-80: Twitter and Slack bots
Lecture: Response data and Slack message formatting
0:00 Now lets construct the data object to pass back to Slack. And this is the standard response like you would expect I have a response type and channel
0:24 a text which is the main text of the message. and attachment. And by the way you can read about
0:42 slack message formatting here. And the attachment is this kind of stuff
1:00 and I got this index from here so I'm going to use title title link, an image URL and a text and a color.
1:08 And a color basically is this vertical bar here. So do some reading for on this because if you know how to properly format slack message you can
1:19 make messages there pretty cool and here you see what I mentioned about the formatting so we have triple back takes for code, single back takes for
1:28 inline code, italic, bold so you can use that in the message and it will come out as if you were typing a message on slack.
1:46 Here we us the image link we made here. Here we use the message we prepared here. And we give it a nice blue color.
2:06 close this, close this close this and that's best practice, as per PEP 8 to align this well vertically so to read well
2:18 and that's almost it I mean then you can just use jsonify which is a utility from flask to return this in a proper format.
2:31 So to receive stator and that's my response so this should be all that is to it. To make a slack command work. Set up a nine point to receive
2:42 a post request for security or just best practice check if the request has the slack token. Get some JSON or run in book
2:53 format the data on image and the message then make a data object consisting of response tack tags and attachment, attachment being optional
3:05 and return it Jsonified and in the next video we're going to test out our app with ngrock