#!/bin/bash WEBHOOK_URL="https://discord.com/api/webhooks/123456789012345678/longassfuckingstring" case "$PAM_TYPE" in open_session) read -r -d '' PAYLOAD << EOM { "embeds": [ { "description": "$PAM_USER logged in from $PAM_RHOST.", "color": 5354307, "author": { "name": "$(uname -n)" } } ] } EOM ;; close_session) read -r -d '' PAYLOAD << EOM { "embeds": [ { "description": "$PAM_USER logged out from $PAM_RHOST.", "color": 12929867, "author": { "name": "$(uname -n)" } } ] } EOM ;; esac if [ -n "$PAYLOAD" ] ; then curl -X POST -H 'Content-Type: application/json' -d "$PAYLOAD" "$WEBHOOK_URL" & fi