AnswerLoopsAnswerLoops Docs
Integrations

GitHub

Ingest GitHub Issues and Discussions as tickets, and sync repo markdown and answered Discussions into the Knowledge Base.

Overview

The GitHub integration does three things:

  1. Ticket ingest — new Issues and Discussions become tickets in AnswerLoops. AI drafts a reply and posts it back as a GitHub comment when confidence is high enough. Issues, comments, and discussions authored by anyone with write access to the repo — owners, org members, and collaborators (GitHub's author_association field) — are skipped, so maintainers filing their own work-tracking issues never turn into support tickets or count against your deflection rate.
  2. Markdown KB sync — markdown files in a repo are embedded into the Knowledge Base. Syncs automatically on every push (when enabled) or manually via Sync now.
  3. Discussions KB sync — answered GitHub Discussions become first-class KB articles: the discussion title is the question, the accepted answer is the answer, attributed to the answering user. A discussion syncs the moment it's marked answered, and un-marking an answer removes the article. Sync now also backfills every already-answered discussion in the repo.

Prerequisites

  • A GitHub App created under your account or org
  • GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY, GITHUB_APP_SLUG, and GITHUB_WEBHOOK_SECRET set in your environment

1. Create a GitHub App

Go to github.com → Settings → Developer settings → GitHub Apps → New GitHub App.

FieldValue
GitHub App nameYour app name (e.g. AnswerLoops)
Homepage URLhttps://yourdomain.com
Callback URLhttps://yourdomain.com/api/auth/callback/github
Setup URL (Post installation)https://yourdomain.com/api/github/callback
Webhook URLhttps://yourdomain.com/api/github/webhook
Webhook secretAny random string — save it as GITHUB_WEBHOOK_SECRET

Under Permissions, set:

  • Repository → Issues: Read & write
  • Repository → Contents: Read-only (for KB sync)
  • Repository → Metadata: Read-only
  • Repository → Discussions: Read-only (or Read & write)

Grant Repository → Discussions before trying to subscribe to Discussion events. GitHub only shows event checkboxes for permissions you've already granted — if Discussions isn't set, the Discussion and Discussion comment checkboxes in the next step won't be visible at all, not greyed out, just missing. If you already saved the app without this permission, add it now, click Save changes (its own button, separate from the rest of the page), accept the org re-authorization prompt, then come back to Subscribe to events.

Under Subscribe to events, tick:

  • Issues
  • Issue comments
  • Discussions
  • Discussion comments
  • Push (for automatic KB sync on push)

Save the app. Note the App ID and your App slug (the URL-safe name).

2. Generate a private key

In your GitHub App settings → Private keysGenerate a private key. This downloads a .pem file.

Base64-encode it:

base64 -i your-app.pem | tr -d '\n'

Set the result as GITHUB_APP_PRIVATE_KEY.

3. Set environment variables

GITHUB_APP_ID=<your-app-id>
GITHUB_APP_PRIVATE_KEY=<base64-encoded-pem>
GITHUB_APP_SLUG=<your-app-slug>
GITHUB_WEBHOOK_SECRET=<your-webhook-secret>

4. Install the app

In your AnswerLoops dashboard, go to Settings → GitHub → Connect GitHub. This opens the GitHub App install page for your account or org. After authorizing, GitHub redirects back and your repos are auto-discovered.

5. Configure per-repo settings

Each connected repo has two controls:

  • Monitored events — choose Issues, Discussions, Both, or None. This governs ticket ingest only.
  • Knowledge Base source — toggle KB sync on/off; Sync now triggers an immediate sync

When KB sync is enabled: every push to the default branch re-embeds all .md and .mdx files automatically, and every discussion marked as answered syncs into the KB immediately (independent of Monitored events — a repo can feed the KB from Discussions even if ticket ingest is set to Issues or None). Sync now re-syncs both markdown files and the full set of currently-answered discussions.

Troubleshooting

On this page