Jamf The Gathering: A Slack Bot’s Story

JNUC happened recently. You might heard about it. Some stuff came up. There was a really awesome burn during the opening keynote.

It was a really nice burn.

Continue reading “Jamf The Gathering: A Slack Bot’s Story”

Build Your Own Jamf Pro Integrations: A Tutorial Series

byo-jpi-logo
Enter a caption

During Penn State MacAdmins 2017, I delivered my first ever workshop style session entitled “Build Your Own Jamf Pro Integrations.” Going in I felt well prepared and convinced that people would walk away feeling empowered to build new kinds of functionality atop their Jamf Pro environments.

The result was not what I envisioned.

Information about the level of experience with Python that was required coming into the workshop was lost in the posting. My slide pacing was too fast. People weren’t given enough time to write down the examples on screen before I would move on to lab sections which did not contain any code examples. Due to a lot of the group not being at the needed experience level with Python I burned through extra time moving around to help them troubleshoot issues and reach the next step. I ended up not finishing all of the content I had prepared and the workshop was left with an unfinished air about it.

Overall, I wasn’t too happy with how the workshop turned out. Some of the attendees afterwards gave me some feedback about what could have been done to improve for a future version (which I was also encouraged to submit for 2018). Make sure the prerequisite experience for the workshop is clearly communicated. The full code being available prior to the workshop would have made transitioning between sections easier. Volunteer assistants to help others with issues and errors as they arise to allow me to focus on delivery. Do a full day and not a half: I had more than enough content to fill it.

Later, when the form submitted feedback was compiled and provided, I found that on a whole the sentiments above were shared by many. They enjoyed the content, they liked the hands-on approach, but structure and timing prevented them from getting the most out of it. The reception was better than I had expected (coming from an IT background, I know it’s more likely that people will submit complaints than compliments).

While I still intend to submit this workshop again for MacAdmins 2018, I have decided to adapt the slide deck into a multi-part tutorial series that will cover building your first Flask (Python) based integration with Jamf Pro and Slack.

Once this post has gone live, each part of the tutorial will go up once a day until the series has been completed. The full code for the complete sample project will be available on my GitHub on day of the last posting.

Requirements

You can use either Python 2 or Python 3, but you will need to create a virtual environment and install the required modules from the Python Package Index (PyPI).

If you are going to use the Python installation that came with your Mac (Python 2) you can install pip and virtualenv using the following commands:

~$ sudo easy_install pip
~$ sudo pip install virtualenv

If you have installed another copy of Python (either 2 or 3) on your Mac, or you are installing Python on Windows or Linux, these commands should be available as a part of that.

Create the virtual environment for the project somewhere in your user directory (the root or your Documents folder would both work):

~$ virtualenv byojamf

To use your new virtual environment call it’s activate script and you will see the environment’s name appear in parenthesis in the terminal session:

~$ source /path/to/byojamf/bin/activate
(byojamf) ~$

Now install the three PyPI modules that we will be using for this sample project:

(byojamf) ~$ pip install flask jook requests

Flask is a microframework for writing web applications.

GitHub: https://github.com/pallets/flask
Documentation: http://flask.pocoo.org/docs/latest/

Requests is an HTTP client library that we will be using to make API requests.

GitHub: https://github.com/requests/requests
Documentation: http://docs.python-requests.org/en/master/

Jook is a Jamf Pro Webhooks simulator to allow you to test your integration.

GitHub: https://github.com/brysontyrrell/Jook
Documentation: http://jook.readthedocs.io/en/latest/

Next up…

An Intro to Webhooks and Flask

I’ll see you in Part I tomorrow!

HipSlack – because we can all be friends (and promoter…)

Channeling my inner David Hayer, “Kept you waiting, huh?”

But really, it has been a while. I’ve had a pretty tumultuous 2015 that pulled me away from projects both at JAMF and personally, and also took time away from the Mac admin communities, but now I’m starting to get back into writing code and just doing stuff like the good old days.

And the best way to do that is throw something out there!

Meet HipSlack

0

Someone, who shall remain nameless, joined JAMF and quipped about using Slack and HipChat side by side. It begged the question, “What, you mean like a bridge?”

45 minutes of my life late than night yielded the initial Flask app that accomplishes the bare minimum functionality that I can build off of: all messages from one HipChat room get piped into a Slack channel, and all the messages from that Slack channel get sent back to the HipChat room.

I’ve posted the initial source code to my GitHub. Right now it only supports one room to one channel and only sends text messages between them. My plans will include supporting multiple room/channel installs, transferring uploaded files between services, mapping emoji/emoticons to display correctly (where possible) and… maybe… see if @mentions could be made to work.

https://github.com/brysontyrrell/HipSlack

Check out the README for instructions on firing this up and playing around with it on your own. Also feel free to improve upon and submit pull requests if you want to take a crack at it before I get around to implementing more features/improvements.

And about promoter…

I threw that up too. Didn’t want people to believe it was vaporware.

https://github.com/brysontyrrell/promoter

Please, please don’t run that as production yet (there’s even a warning!).