This media type integrates your Zabbix installation with GitHub using the Zabbix webhook feature.

GitHub configuration:

1. Create an access token.

One of the simplest ways to send authenticated requests is to use a personal access token - either a classic or a fine-grained one:
https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-a-personal-access-token

Classic personal access token

You can create a new classic personal access token by following the instructions in the official documentation:
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic

The token user must have a permission to create issues and issue comments in the desired repositories. For webhook to work on private repositories, the "repo" scope must be set in token settings to have full control of private repositories.

Additional information about OAuth scopes is available in the official documentation:
https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes

Fine-grained personal access token

Alternatively, you can use a fine-grained personal access token:
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token

In order to use fine-grained tokens to monitor organization-owned repositories, organizations must opt in to fine-grained personal access tokens and set up a personal access token policy:
https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization

The fine-grained token needs to have the following permission set to provide access to the repository issues:
- "Issues" repository permissions (write)

2. Copy and save the created token somewhere, as it will be shown only once for security reasons.

Zabbix configuration:

1. Before you can start using Zammad webhook, set up the global macro "{$ZABBIX.URL}":
- In the Zabbix web interface, go to "Administration" → "Macros" section in the dropdown menu in the top left corner.
- Set up the global macro "{$ZABBIX.URL}" which will contain the URL to the Zabbix frontend. The URL should be either an IP address, a fully qualified domain name, or localhost.
- Specifying a protocol is mandatory, whereas the port is optional. Depending on the web server configuration you might also need to append "/zabbix" to the end of URL. Good examples:
  - http://zabbix.com
  - https://zabbix.lan/zabbix
  - http://server.zabbix.lan/
  - http://localhost
  - http://127.0.0.1:8080
- Bad examples:
  - zabbix.com
  - http://zabbix/

2. Set the "github_token" webhook parameter value to the access token that you created previously.

You can also adjust the issue labels created by the webhook in the following parameters:
- github_zabbix_event_priority_label_prefix - the prefix for the issue label that displays the Zabbix event priority in the supported event sources. It is set to "Zabbix Event Priority: " by default.
- github_zabbix_event_source_label_prefix - the prefix for the issue label that displays the Zabbix event source. It is set to "Zabbix Event Source: " by default.
- github_zabbix_event_status_label_prefix - the prefix for the issue label that displays the Zabbix event status. It is set to "Zabbix Event Status: " by default.
- github_zabbix_generic_label - the label that is added to all issues created by the webhook. It is set to "Zabbix GitHub Webhook" by default.

Note that the webhook will reuse the labels with the same name that already exist in the repository (including the color, so it can changed from the default value for new labels in GitHub, if needed). Also, the labels are replaced when the issue is updated, so any user-added labels will be removed.

4. Create a Zabbix user and add media:
- If you want to create a new user, go to the "Users" → "Users" section, click the "Create user" button in the top right corner. In the "User" tab, fill in all required fields (marked with red asterisks).
- In the "Media" tab, add a new media and select "Zammad" type from the drop-down list. In field "Send to" specify the full repo name (owner/project name) e.g. johndoe/example-project.
- Make sure this user has access to all hosts for which you would like problem notifications to be sent to GitHub.

5. Great! You can now start using this media type in actions and create GitHub issues!

You can find the latest version of this media and additional information in the official Zabbix repository:
https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/github