There is currently one main API endpoint to send messages to your Apple Watch. You can use either JSON or a Form POST. Both are equally well supported.
A JSON request has a content type of application/json
and sends a simple struct that contains all the message parameters.
https://api.astronote.app/1/notify
Content-Type: application/json
Authorization: token YOURTOKEN
{ "title": "Some title" }
A Form request has a content type of application/x-www-form-urlencoded
and sends the message parameters in the body.
https://api.astronote.app/1/notify
Content-Type: application/x-www-form-urlencoded
Authorization: token YOURTOKEN
title=Some+Title
body=This+is+the+body.
To authenticate your request, you need to send your API Token in the Authorization
header.
Authorization: token a2RlamRramRlZDhkMzgyM2xramVsa2
You can find the authentication tokens for your devices on the Devices & Tokens page.
For a Form Post request you can also add a token
parameter to the request. However, the above header method is recommended.
You can configure the look and feel and behaviour of the notification messages with the following parameters. A request should at least have a title
or body
.
title
Optional, but either title or body must be given.
title
is shown in bold text at the top of a notification.title
is UTF-8 encoded and can contain any character that is supported by watchOS, including emoji characters.body
Optional, but either title or body must be given.
body
is shown in plain text at the top of a notification.body
can be up to 2048 bytes long and may contain line breaks for paragraphs.body
is UTF-8 encoded and can contain any character that is supported by watchOS, including emoji characters.category
Optional.
category
is given, the message will be saved in a mailbox with the same name in the AstroNote application.persistent
flag (see below) is set to false
, the category may be shown in the notification view, but the message will not be saved.displayCategory
Optional. Defaults to false
.
displayCategory
is set to true
, the category is also displayed in the notification.sound
Optional. Defaults to default
. The only two options are currently silent
and default
.
default
sound will play the standard Apple Watch notification sound.silent
then the notification will not announce itself audibly.persistent
Optional. Defaults to true
.
category
was also supplied, the message will be saved in a mailbox with that name.