Skip to content

Instantly share code, notes, and snippets.

SLACK_WEBHOOK="https://hooks.slack.com/services/A123456"
IMAGE="https://<s3bucket>/MBPJamf.png"
SSID="acme-wifi"
danger=0
computer_name=$(scutil --get ComputerName)
primary_user=$(cat /etc/.seek)
title="SEEK Setup Completed for *$computer_name*"
text="*JSS ID:* $JSS_ID\n*Primary User:*"
#!/bin/bash
WEBHOOK_URL=<SLACK WEBHOOK URL>
IMAGE=<EXTERNALLY HOSTED IMAGE>
JSS=<JSS ADDRESS>
# API Account that has read access to Jamf Pro Server Objects > Computers
API_USER=<API USERNAME>
API_PW=<API PASSWORD>
UDID=$(system_profiler SPHardwareDataType | grep "UUID" | sed s/"Hardware UUID: "/''/g | sed 's/^ *//')
#!/bin/bash
# MenuBarTrigger Example
function create_webviews() {
echo "
html,
body {
overflow: hidden;
width: 270px;
import json
from urllib import parse as urlparse
def lambda_handler(event, context):
message_from_slack = dict(urlparse.parse_qsl(event["body"]))
response_url = message_from_slack["response_url"]
message_for_slack = "*Request received from Slack slash command:*\n" + str(event) + "\n\n*Request body _before_ decoding:*\n" + event["body"] + "\n\n*Request body _after_ decoding:*\n" + str(message_from_slack)
response_json = {
import json
from urllib import parse as urlparse
import urllib.parse
def lambda_handler(event, context):
request_body = event["body"]
decodedBody = event["body"].replace('payload=','', 1)
decodedBody = urllib.parse.unquote(decodedBody)
decodedBody = json.loads(decodedBody.replace("\\",""))
# slackapp_initial_slash_command_invoked.py
# This function is invoked from a Slack slash command
# It verifies the request, responds to it, and invokes the SNS topic for the
# second lambda function, if required.
# Author: @taniacomputer
# Last modified: 20/11/2019
import json
import hashlib
import hmac
# slackapp_run_matchSearch.py
# This function is invoked by an SNS topic
# and runs a Jamf Pro equivalent of an advanced search
# formatting the results and sending them back to Slack
# Author: @taniacomputer
# Last modified: 20/11/2019
import json
from botocore.vendored import requests
import boto3
# slackapp_buttonClicked.py
# This function responds to the More Info button click
# It verifies that the request is from slack and publishes to the SNS topic
# that will trigger the lambda function to provide the user their requested More Info summary
# Author: @taniacomputer
# Last modified: 20/11/2019
import json
import hashlib
import hmac
# slackapp_idSearch.py
# This function is invoked by an SNS topic
# and runs a Jamf Pro equivalent of a computer id search,
# formatting the results and sending them back to Slack
# Author: @taniacomputer
# Last modified: 20/11/2019
import json
import boto3
from botocore.vendored import requests
# This is the script content of a Jamf Pro Extension Attribute called
# "slack - :lock: Security Health Status"
# Because it has "slack -" in its title, our /jamf Slack app will display the output of its results in each Mac's health summary report.
# It checks to see if the Mac has SIP and FV enabled and is running the required 3rd party AV agent
# Based on the results, it displays the appropriate emoji and also provides appropriate links to relevant kb articles or Jamf Self Service policies.
# Author: @taniacomputer
# Last modified: 4/12/2019
#!/bin/bash