-
Notifications
You must be signed in to change notification settings - Fork 0
/
pi.sh
executable file
·25 lines (20 loc) · 1.01 KB
/
pi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
echo "Send push message to iOS device"
MSG="Usage pi.sh \"APID\" \"alert message\""
## validate device
if [[ "$1" = "" ]]; then
echo "You need to input a message as a first parameter"
echo $MSG
exit 1
fi
## validate message
if [[ "$2" = "" ]]; then
echo "You need to input a message as a second parameter"
echo $MSG
exit 1
fi
#echo "device token: $1"
#echo "message: $2"
DATA="{\"device_tokens\": [\"$1\"], \"aps\": {\"alert\": \"$2\"}}"
curl -X POST -u "rJ-ZDlhzRniVcFBgfRHM2A:EZ-EbsFnTtKgXTh7Op8qMQ" -H "Content-Type: application/json" --data "$DATA" https://go.urbanairship.com/api/push/
echo ""