Skip to content

GitHub Notifications

Overview

Apprise connects to GitHub with an access token.

For notifications from GitHub Actions to the same repository, use the workflow’s built-in token. See GitHub Actions.

  1. Visit https://github.com/settings/personal-access-tokens and click Generate new token. This creates a fine-grained token, which can only touch the repositories you pick.
  2. Give it a name you will recognize later, such as Apprise, and choose an Expiration. GitHub will email you before it expires.
  3. Set Resource owner to the user or organization that owns the repository.
  4. Under Repository access, choose Only select repositories and pick the repository you want to notify.
  5. Under Permissions, add the ones you need from the table below. Metadata: Read-only is added for you.
  6. Click Generate token and copy it right away. It starts with github_pat_ and is only shown once.
What you want Apprise to do Permission to add
Open new issues Issues: Read and write
Comment on issues Issues: Read and write
Comment on pull requests Pull requests: Read and write (or Issues: Read and write)
Start new discussions Discussions: Read and write
Comment on discussions Discussions: Read and write

A classic token (starting with ghp_) also works. Give it the repo scope, or just public_repo if the repository is public.

Replace https://github.com/ with github://{token}@ to turn a GitHub page into an Apprise URL. The examples below show the matching GitHub page above each command.

The repository root opens a new issue, while /discussions starts a new discussion. Add an issue, pull request or discussion number to comment on that item.

Paths ending in /new, such as /issues/new, also create a new item. Pull requests always need a number because Apprise can comment on them but cannot create them.

To notify more than one place, add one URL for each. A URL with two numbers in it, such as /issues/12/23, is refused.

Discussions must be turned on for the repository first: open its Settings, then under Features tick Discussions.

For a job that runs every night, pointing at one issue (/issues/42) keeps all of its reports in one thread, instead of opening a new issue each time.

GitHub has no way to add file attachments through its API, so attachments are not supported.

Valid syntax is as follows:

  • github://{token}@{owner}/{repo}
  • github://{token}@{owner}/{repo}/issues/{number}
  • github://{token}@{owner}/{repo}/pull/{number}
  • github://{token}@{owner}/{repo}/discussions
  • github://{token}@{owner}/{repo}/discussions/{number}
  • github://{owner}/{repo}/?token={token}
Variable Required Description
token Yes Your GitHub access token.
owner Yes The user or organization that owns the repository.
repo Yes The repository name.
kind No What the URL points at: issues (the default), pull or discussions.
number No The issue, pull request or discussion number to comment on. Leave it out to open a new issue or start a new discussion. A pull request always needs one.
labels No A comma-separated list of labels to add to a new issue. The labels must already exist in the repository.
assignees No A comma-separated list of GitHub usernames to assign a new issue to.
category No The category to start a new discussion in. Both the name (Show and tell) and the short name used in GitHub links (show-and-tell) work. The default is General.

When a new issue or discussion is opened, the notification title becomes its title. If there is no title, Apprise Notifications is used. When commenting, the title is placed at the top of the comment.

Variable Description
overflow Controls messages that exceed a service’s documented limit. The default is upstream.
👉 upstream: Send one message without splitting or truncating it for that limit.
👉 truncate: Keep the portion that fits and discard the rest.
👉 split: Prefer a readable break, fall back to a hard boundary, and send every part in order.
Splitting undeclared or structured content is best effort. Use upstream when the body must remain one intact document.
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.
redirect By default, Apprise will follow HTTP redirects (3xx responses) issued by the remote server, matching the behaviour of the underlying requests library. If you want to prevent custom headers and credentials from being forwarded to destinations that differ from the original URL, set this 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.
retry The number of additional delivery attempts to make after the first failure before giving up. Accepts an integer in the range 0 to 10. The default is 0 (no retries – a single attempt is made). When combined with wait, Apprise pauses the specified number of seconds between each attempt.
wait The number of seconds to pause between retry attempts. Accepts a decimal value in the range 0.0 to 20.0; integer values are promoted to float automatically. The default is 0.5. This value is only meaningful when retry is greater than zero – a service with retry=0 makes exactly one attempt regardless of the wait value.
optional When set to yes, a delivery failure for this service is silently absorbed. The overall notify() call still evaluates as true even if this endpoint was unreachable, provided that every required (non-optional) service in the same batch succeeded. Setting this flag does not skip delivery or bypass retry logic – all configured retry attempts are still made before the failure is absorbed. By default this is set to no, meaning every failure is propagated to the caller.

Open a new issue:

Terminal window
# GitHub page: https://github.com/caronc/apprise
apprise -vv -t "Nightly load failed" -b "The **load** step failed." \
"github://github_pat_abc123@caronc/apprise"

Open a new issue with labels, assigned to a user:

Terminal window
# GitHub page: https://github.com/caronc/apprise
apprise -vv -t "Nightly load failed" -b "The **load** step failed." \
"github://github_pat_abc123@caronc/apprise?labels=bug,nightly&assignees=caronc"

Comment on an existing issue or pull request:

Terminal window
# GitHub page: https://github.com/caronc/apprise/issues/42
apprise -vv -t "Nightly load failed" -b "The **load** step failed." \
"github://github_pat_abc123@caronc/apprise/issues/42"
# GitHub page: https://github.com/caronc/apprise/pull/1807
apprise -vv -b "The build passed." \
"github://github_pat_abc123@caronc/apprise/pull/1807"

Start a new discussion, or comment on an existing one:

Terminal window
# GitHub page: https://github.com/caronc/apprise/discussions
apprise -vv -t "Version 2.0 is out" -b "Read the **release notes** for details." \
"github://github_pat_abc123@caronc/apprise/discussions?category=Announcements"
# GitHub page: https://github.com/caronc/apprise/discussions/7
apprise -vv -b "This is now fixed." \
"github://github_pat_abc123@caronc/apprise/discussions/7"

GitHub Actions can send directly through github://, or call a self-hosted Apprise API server. Keep tokens and API credentials in GitHub secrets; GitHub masks registered secret values in workflow logs.

The built-in secrets.GITHUB_TOKEN works only with the repository running the workflow. Choose its access with a permissions: block:

What you want Apprise to do Permission in the workflow
Open new issues issues: write
Comment on issues issues: write
Comment on pull requests pull-requests: write
Start or comment on discussions discussions: write

${{ github.repository }} already holds owner/repo, so it slots straight into the Apprise URL.

This workflow uses the built-in token to comment on a pull request when its tests fail:

name: Tests
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.x"
- name: Run the tests
run: ./run-tests.sh
- name: Comment on the pull request
if: failure()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
pip install apprise
apprise -vv -t "Tests failed" -b "See the [workflow run]($RUN_URL) for details." \
"github://${GH_TOKEN}@${{ github.repository }}/pull/${{ github.event.pull_request.number }}"

To notify a different repository, create a token as described in Creating a Token, then store it as a repository or environment secret:

  1. Open the repository that runs the workflow and click Settings.
  2. In the sidebar, under Security, click Secrets and variables, then Actions.
  3. Click New repository secret.
  4. Enter a name such as APPRISE_GITHUB_TOKEN, paste your token as the value, and click Add secret.

If you use the GitHub CLI, gh secret set APPRISE_GITHUB_TOKEN does the same thing.

Secret names cannot start with GITHUB_, so a name like GITHUB_TOKEN_APPRISE is refused.

Use that secret in place of the built-in token:

jobs:
load:
runs-on: ubuntu-latest
environment: notifications
env:
GH_TOKEN: ${{ secrets.APPRISE_GITHUB_TOKEN }}
# ...steps that install Apprise and run your job...
steps:
- name: Open an issue in caronc/reports
run: |
apprise -t "Nightly load failed" -b "Review the workflow logs." \
"github://${GH_TOKEN}@caronc/reports?labels=nightly"

The environment: notifications line uses secrets from a GitHub environment named notifications. Omit it when using repository secrets.

Questions or Feedback?

Documentation

Notice a typo or an error?

Technical Issues

Having trouble with the code? Open an issue on GitHub:

Made with love from Canada