Skip to content

Instantly share code, notes, and snippets.

@brunovegreville
Created March 15, 2022 09:32
Show Gist options
  • Save brunovegreville/7eeb83e5ed7d4119a178140665ee0079 to your computer and use it in GitHub Desktop.
Save brunovegreville/7eeb83e5ed7d4119a178140665ee0079 to your computer and use it in GitHub Desktop.
Simple Raycast script to check if there are appointments at the Mairie de Parie
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Check appointments
# @raycast.mode inline
# @raycast.refreshTime 15m
# Optional parameters:
# @raycast.icon 🏠
in_14_d=$(date -v +14d +"%d/%m/%Y")
no_appointments=`curl -d "to_date=$in_14_d" -X POST https://teleservices.paris.fr/rdvtitres/jsp/site/Portal.jsp\?page\=appointmentsearch\&category\=titres -s | grep "Aucun rendez-vous"`
if [ -z "$no_appointments" ]
then
curl -X POST https://api.sendgrid.com/v3/mail/send \
--header "Authorization: Bearer xxx" \
--header "Content-Type: application/json" \
--data '{"personalizations":[{"to": [{
"email": "xxx@hera.so",
"name": "Bruno"
},{
"email": "xxx@gmail.com",
"name": "Ghita"
}]}],
"from": {
"email": "xxx",
"name": "Bruno bot"
},
"subject": "Appointments available!",
"content": [
{
"type": "text/html",
"value": "<p>There are available appointments: https://teleservices.paris.fr/rdvtitres/jsp/site/Portal.jsp?page=appointmentsearch&category=titres</p>"
}
]}'
echo -e "\\033[32mAppointments available 🎉\\033[32m"
else
echo -e "\\033[31mNo appointments 😭\\033[31m"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment