First, make sure that you have the Hedwig app, and the Hedwig CLI installed. You can find out how to install the Hedwig app and the Hedwig CLI on the installation instructions page.
You can check to make sure that Hedwig is fully installed by running hedwig -version
. You should get an output that looks something like this.
$ hedwig -version
🦉 Hedwig v0.1.0 (darwin/amd64)
Then, take note of your Push Token. It should start with ExponentPushToken
. It can be found by opening the Hedwig app. You can then configure the Hedwig CLI to use your Push Token.
Note! Replace
yourPushToken
with your actual Push Token! Also, make sure to put your Push token in quotes, otherwise, shells tend to get confused.
$ hedwig -add-recipient-global "yourPushToken"
Added recipient to global config
You are now ready to send your first push notification!
$ hedwig "Hello, world\!"
Hedwig will send a push notification to your phone!
Hedwig
Message from Hedwig!Hello, world!
You can also include a title in your push notification.
$ hedwig -title "Upcoming class\!" "You have \"Introduction to Charms\" in 10 minutes."
Hedwig
Upcoming class!You have "Introduction to Charms" in 10 minutes.
You can use this along with cron
to make a makeshift calendar system! Say you have Defence Against the Dark Arts II Monday through Friday at 11am. You could add a Hedwig command to your crontab
to notify you every day.
55 10 * * 1-5 hedwig -title "Upcoming class\!" "You have \"Defence Against the Dark Arts II\" in 5 minutes."
Hedwig
Upcoming class!You have "Defence Against the Dark Arts II" in 5 minutes.
You can learn more about all the options available with the Hedwig CLI using the -help
flag.
$ hedwig -help
Usage of hedwig:
-add-recipient-global string
Adds a recipient to the config file
-badge int
Number to put on the badge on in iOS app
-recipient string
The recipent of the message. If this isn\'t specified, it defaults to every recipeint in the config file
-sound string
The sound to play on iOS (default "default")
-title string
The title of the notification (default "Message from Hedwig!")
-ttl int
Time to live, in seconds, for the message
-version
Shows the version of the Hedwig CLI