Vapid/WebPush Notifications
Ce contenu n’est pas encore disponible dans votre langue.
Account Setup
Section titled “Account Setup”Vapid/WebPush requires a subscriptions.json file that identifies all of the users you wish to notify and a private_key.pem
Syntax
Section titled “Syntax”Valid syntax is as follows:
vapid://subscription_id/vapid://subscription_id/targetvapid://subscription_id/target1/target2/targetN/
Parameter Breakdown
Section titled “Parameter Breakdown”| Variable | Required | Description |
|---|---|---|
| keyfile | Yes | A private key in PEM format belonging to the account associated with the subscription_id |
| subfile | Yes | A subscriptions.json file identifying the configuration you wish to reference. |
| mode | No | The mode to use (default chrome). Possible values are chrome, firefox, edge, and opera. This just simplifies the upstream source that is used when the notification is sent. |
Mode Table: You will see a lot of duplication (many modes pointing to the same location). The idea is if the end points change, we will update it inside Apprise so your code/URL will not have to change later.
| Mode | URL |
|---|---|
| chrome | https://fcm.googleapis.com/fcm/send |
| forefpx | https://updates.push.services.mozilla.com/wpush/v1 |
| edge | https://fcm.googleapis.com/fcm/send |
| opera | https://fcm.googleapis.com/fcm/send |
| apple | https://web.push.apple.com' |
| brave | https://fcm.googleapis.com/fcm/send |
| samsung | https://fcm.googleapis.com/fcm/send |
| generic | https://fcm.googleapis.com/fcm/send |
Global Parameters
Section titled “Global Parameters”| Variable | Description |
|---|---|
| overflow | This parameter can be set to either split, truncate, or upstream. This determines how Apprise delivers the message you pass it. By default this is set to upstream 👉 upstream: Do nothing at all; pass the message exactly as you received it to the service.👉 truncate: Ensure that the message will fit within the service’s documented upstream message limit. If more information was passed then the defined limit, the overhead information is truncated.👉 split: similar to truncate except if the message doesn’t fit within the service’s documented upstream message limit, it is split into smaller chunks and they are all delivered sequentially there-after. |
| format | This parameter can be set to either text, html, or markdown. Some services support the ability to post content by several different means. The default of this varies (it can be one of the 3 mentioned at any time depending on which service you choose). You can optionally force this setting to stray from the defaults if you wish. If the service doesn’t support different types of transmission formats, then this field is ignored. |
| verify | External requests made to secure locations (such as through the use of https) will have certificates associated with them. By default, Apprise will verify that these certificates are valid; if they are not then no notification will be sent to the source. In some occasions, a user might not have a certificate authority to verify the key against or they trust the source; in this case you will want to set this flag to no. By default it is set to yes. |
| cto | This stands for Socket Connect Timeout. This is the number of seconds Requests will wait for your client to establish a connection to a remote machine (corresponding to the connect()) call on the socket. The default value is 4.0 seconds. |
| rto | This stands for Socket Read Timeout. This is the number of seconds the client will wait for the server to send a response. The default value is 4.0 seconds. |
| emojis | Enable Emoji support (such as providing :+1: would translate to 👍). By default this is set to no. Note: Depending on server side settings, the administrator has the power to disable emoji support at a global level; but default this is not the case. |
| tz | Identify the IANA Time Zone Database you wish to operate as. By default this is detected based on the configuration the server hosting Apprise is running on. You can set this to things like America/Toronto, or any other properly formated Timezone describing your area. |
subscriptions.json Setup
Section titled “subscriptions.json Setup”In order to use Vapid, you must have a subscriptions.json file that it can point to. The Vapid plugin supports the 2 following formats:
-
standalone; in the below example, the target would be
abc123{"endpoint": "https://fcm.googleapis.com/fcm/send/abc123","keys": {"p256dh": "BNcW4oA7zq5H9TKIrA3XfKclN2fX9P_7NR...","auth": "k9Xzm43nBGo="}} -
multiple target support; in the below example, 2 targets are created called
name1andname2{"name1": {"endpoint": "https://fcm.googleapis.com/fcm/send/...","keys": {"p256dh": "BNcW4oA7zq5H9TKIrA3XfKclN2fX9P_7NR...","auth": "k9Xzm43nBGo=",}},"name2": {"endpoint": "https://fcm.googleapis.com/fcm/send/...","keys": {"p256dh": "BNcW4oA7zq5H9TKIrA3XfKclN2fX9P_7NR...","auth": "k9Xzm43nBGo=",}}
It is though targets that you notify one or more endpoints. If you’re using persistent storage with Apprise, you can simply manage your subscription.json file located here and your URL can stay clean. Alternatively, you can specify ?subfile= on your URL and point it to a subscription file you wish to load. The location can be local to the filesystem as well as a remote location (such as subfile=https://user:pass@myhost/special/location/subscription.json
If no target is specified on your URL, then a target that matches your own subscriberid is looked up in the subcriptions.json file
Private Key (PEM) Setup
Section titled “Private Key (PEM) Setup”Similar to the subscription.json, you need to point to a private_key.pem file. If you are using Apprise persisent storage, you can place the file here. Alternatively you can specify ?keyfile= on the URL and point it to a local or remote file you wish to use.
Persistent Storage Tips
Section titled “Persistent Storage Tips”The following command will list all of the persistent storage locations associated with your configuration:
apprise storage listSimply locate the ID associated with the Vapid account you wish to update; consider that the directory ID’s can be found as:
- Microsoft Windows:
%APPDATA%/Apprise/cache - Linux:
~/.local/share/apprise/cache
For more details on this; see here.
Apprise URL Construction
Section titled “Apprise URL Construction”This is a more complicated plugin to work with since it requires a binary PEM private key and a subscription.json file as well. It would be advised to use a Apprise Configuration YAML file that looks like this:
urls: - vapid://: mode: apple keyfile: /path/to/keyfile subfile: /path/to/subscription.jsonRemember that both the keyfile and subfile can be URLs as well (even ones protected behind user/passwords such as:
urls: - vapid://: mode: apple keyfile: https://user:pass123@example.com/private_key.pem subfile: https://user:pass123@example.com/subscriptions.jsonIf you do not define a keyfile and/or a subfile, the rules above apply as documented above and default ones are looked upon in your persistent storage directory.