# New Help Automation & Onboarding Intake Features (Dashboard v …)

# New Help Automation & Onboarding Intake Features (Dashboard v …)

**What’s new?**  
The dashboard now includes a **Help Automation** page that lets you connect a GitHub repository to usedocs so that PR / pull‑request events automatically create draft help‑center articles.  
The onboarding wizard also asks a few intake questions (goal, audience, source, integrations) and saves the answers for future use.

---

## 1. Help Automation – connect your repo in a few clicks

### Where to find it
1. Open the **Help Center** from the left‑hand navigation.  
2. Click the **Automation** tab (the new tab appears next to *Redirects*).

### What you can do
| Action | What it does |
|--------|--------------|
| **Add / edit repository** | Enter the GitHub repo you want usedocs to watch (e.g. `myorg/my‑docs`). |
| **Skip automation** | If you don’t want webhook‑driven drafts, toggle *Skip* – the UI will hide the secret and webhook fields. |
| **Rotate secret** | Generates a fresh `GITHUB_WEBHOOK_SECRET`. Copy the new secret **immediately** – it is shown only once. |
| **View webhook URL** | The URL you must configure in your GitHub repo’s **Settings → Webhooks**. |
| **Check verification status** | The UI shows whether the webhook has been verified, when it was verified, and the timestamp of the last event received. |

### Setting up the webhook in GitHub
1. In your GitHub repo, go to **Settings → Webhooks → Add webhook**.  
2. **Payload URL** – paste the **Webhook URL** shown in the Automation tab.  
3. **Content type** – select `application/json`.  
4. **Secret** – paste the **Secret** you copied from the Automation tab.  
5. **Which events would you like to trigger this webhook?** – select **Pull requests** (and optionally **Releases**).  
6. Click **Add webhook**.

> **Important:** The secret is displayed **only once**. If you lose it, use the **Rotate** button to generate a new one and update the GitHub webhook.

### What happens after the webhook is active
* When a PR is opened, merged, or a release is published, usedocs receives the event, creates a **draft article** (and a changelog entry) in the Help Center, and flags it for human review.  
* Drafts are **not published automatically** – you must approve them in the Help Center before they go live.

---

## 2. Onboarding Intake – a quick questionnaire that tailors your setup

### New questions shown during the first‑time wizard
| Question | Why we ask it |
|----------|---------------|
| **Goal** – “What should usedocs do first?” | Determines whether you’re building a public help center, an internal knowledge base, etc. |
| **Audience** – “Who will read the docs?” | Helps us suggest default styling, branding, and access controls. |
| **Source** – “Where does your content live today?” | Lets us pre‑configure connectors (GitHub, Notion, etc.). |
| **Integrations** – “Which tools do you want to connect?” | Enables quick toggles for Slack, Zapier, etc. |

The answers are stored in **localStorage** under the key `usedocs-intake-<botId>` and are used when you finish the wizard (e.g., to pre‑fill the Automation page). If you clear your browser data, the intake will be lost and you’ll be prompted again.

### How it appears in the UI
When the wizard finishes, a toast says **“Setup complete — your bot is live.”** If the wizard detected that you selected the “help” goal, the toast also points you to the Automation tab for the next step.

---

## 3. Behind the scenes – API & data model changes

| Endpoint | New / Updated |
|----------|---------------|
| `GET /help/automation` | Returns the current webhook configuration (`webhookUrl`, `secret`, `verified`, timestamps, etc.). |
| `POST /help/automation` | Save or update the repo, skip flag, or rotate the secret. |
| Bot stats (`/api/bot/:id`) | New fields: `githubInstallationId`, `githubWebhookConfigured`, `githubWebhookVerified

---

_Drafted from merged PR: [PR: Staging](https://github.com/manish-raana/usedocs/pull/20). Review before publish._
