Updated Notify_sparkpost (markdown)

master
Chris Caron 2020-10-04 11:13:18 -04:00
parent 689fdde582
commit 7d03c1e481
1 changed files with 23 additions and 2 deletions

@ -43,7 +43,7 @@ The Carbon Copy (**cc=**) and Blind Carbon Copy (**bcc=**) however are applied t
| bcc | No | Blind Carbon Copy email address(es). More than one can be separated with a space and/or comma. | bcc | No | Blind Carbon Copy email address(es). More than one can be separated with a space and/or comma.
#### Example #### Example
Send a sparkpost notification to the email address bill.gates@microsoft.com Send a sparkpost notification to the email address `bill.gates@microsoft.com`
```bash ```bash
# Assuming the {domain} we set up with our sparkpost account is example.com # Assuming the {domain} we set up with our sparkpost account is example.com
# Assuming our {apikey} is 4b4f2918fddk5f8f91f # Assuming our {apikey} is 4b4f2918fddk5f8f91f
@ -53,7 +53,7 @@ apprise sparkpost:///noreply@example.com/4b4f2918fddk5f8f91f/bill.gates@microsof
``` ```
### Header Manipulation ### Header Manipulation
Some users may require special HTTP headers to be present when they post their data to their server. This can be accomplished by just sticking a hyphen (**-**) in front of any parameter you specify on your URL string. Some users may require special HTTP headers to be present when they post their data to their server. This can be accomplished by just sticking a hyphen (**-**) in front of any parameter you specify on your URL string. The below examples send a sparkpost notification to the email address `bill.gates@microsoft.com` while leveraging the header manipulation.
```bash ```bash
# Below would set the header: # Below would set the header:
# X-Token: abcdefg # X-Token: abcdefg
@ -77,3 +77,24 @@ apprise -vv -t "Test Message Title" -b "Test Message Body" \
apprise -vv -t "Test Message Title" -b "Test Message Body" \ apprise -vv -t "Test Message Title" -b "Test Message Body" \
"sparkpost:///noreply@example.com/4b4f2918fddk5f8f91f/bill.gates@microsoft.com/?+X-Token=abcdefg&+X-Apprise=is%20great" "sparkpost:///noreply@example.com/4b4f2918fddk5f8f91f/bill.gates@microsoft.com/?+X-Token=abcdefg&+X-Apprise=is%20great"
``` ```
### Global Substitution
SparkPost allows you to identify `{{tokens}}` that are wrapped in 2 curly braces. [See here on their section of templating](https://developers.sparkpost.com/api/template-language/) for more details. If you wish to pass in a keyword and it's substituted value, simply use the colon (**:**) in front of any parameter you specify on your URL string. The below examples send a sparkpost notification to the email address `bill.gates@microsoft.com` while leveraging the header manipulation.
```bash
# Below would set the token {{software}} to be substituted with Microsoft:
# Assuming the {domain} we set up with our sparkpost account is example.com
# Assuming our {apikey} is 4b4f2918fddk5f8f91f
# We already know our To {email} is bill.gates@microsoft.com
# Assuming we want our email to come from noreply@example.com
apprise -vv -t "Test Message Title" -b "Bill Gates works at {{software}}" \
"sparkpost:///noreply@example.com/4b4f2918fddk5f8f91f/bill.gates@microsoft.com/?+software=Microsoft"
```
You can specify as many tokens as you like. Apprise automatically provides some default (out of the box) translated tokens if you wish to use them; they are as follows:
* **app_id**: The Application identifier; usually set to `Apprise`, but developers of custom applications may choose to over-ride this and place their name here. this is how you acquire this value.
* **app_desc**: Similar the the Application Identifier, this is the Application Description. It's usually just a slightly more descriptive alternative to the *app_id*. This is usually set to `Apprise Notification` unless it has been over-ridden by a developer.
* **app_color**: A hex code that identifies a colour associate with a message. For instance, `info` type messages are generally blue where as `warning` ones are orange, etc.
* **app_type**: The message type itself; it may be `info`, `warning`, `success`, etc
* **app_title**: The actual title (`--title` or `-t` if from the command line) that was passed into the apprise notification when called.
* **app_body**: The actual body (`--body` or `-b` if from the command line) that was passed into the apprise notification when called.
* **app_url**: The URL associated with the Apprise instance (found in the **AppriseAsset()** object). Unless this has been over-ridden by a developer, it's value will be `https://github.com/caronc/apprise`.