Skip to content

Instantly share code, notes, and snippets.

@alifeee
Created April 20, 2025 15:24
Show Gist options
  • Save alifeee/1b7d78315e6fe735876716ad8a053257 to your computer and use it in GitHub Desktop.
Save alifeee/1b7d78315e6fe735876716ad8a053257 to your computer and use it in GitHub Desktop.
gath.io batch event creator - for creating a few similar events
#!/bin/bash
# send a form submission to gath.io
if [ -z "${1}" ]; then
echo "need date and time as first argument"
echo "./send.sh XXXX-XX-XXTXX:XX"
exit 1
fi
start_date="${1}"
time_taken="30min"
# get a nice date with "nd" or "th" ordinal
d_day=$(date --date="${start_date}" +%A)
d=$(date --date="${start_date}" +%d)
d_time=$(date --date="${start_date}" +%R)
case $d in
1?) d=${d}th ;;
*1) d=${d}st ;;
*2) d=${d}nd ;;
*3) d=${d}rd ;;
*) d=${d}th ;;
esac
# things that change
eventName="new space visit - ${d_day} ${d} ${d_time}"
eventStart=$(date --date="${start_date}" '+%Y-%m-%dT%H:%M')
eventEnd=$(date --date="${start_date} ${time_taken}" '+%Y-%m-%dT%H:%M')
echo "eventName: ${eventName}"
echo "eventStart: ${eventStart}"
echo "eventEnd: ${eventEnd}"
read -e -p "does this look ok (y)? " OK
[[ $OK != "y" ]] && exit 1
echo "ok! submitting!"
# things that stay the same
eventDescription='Please see the [group description](https://gath.io/group/mhFs75I1S8yoTLG470F5N#eventDescription) for more information.
Please see below for booking and a list of attendees.'
eventLocation="Town Square"
items=(
"timezone=Europe/London"
"eventURL="
"hostName="
"[email protected]"
"eventGroupID=uawihg828ghw28jg82"
"eventGroupEditToken=289tuf908wu2tj389jg893gtj38jg83"
"publicCheckbox=false"
"interactionCheckbox=false"
"joinCheckbox=true"
"maxAttendeesCheckbox=true"
"maxAttendees=2"
"eventGroupCheckbox=true"
"imageUpload=undefined"
"magicLinkToken="
)
for item in "${items[@]}"; do
formdata="${formdata} --form ${item}"
done
save_to="result_${start_date}.txt"
res=$(curl 'https://gath.io/event' \
-X POST \
-s \
--form "eventName=${eventName}" \
--form "eventDescription=${eventDescription}" \
--form "eventStart=${eventStart}" \
--form "eventEnd=${eventEnd}" \
--form "eventLocation=${eventLocation}" \
${formdata})
echo "${res}" >> "${save_to}"
echo "saved response to ${save_to}"
echo "you should probably save the editing password, click this link"
echo "${res}" | jq -r '"https://gath.io" + .url'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment