|  | 
|  | 1 | +import { z } from "zod"; | 
|  | 2 | + | 
|  | 3 | +import { | 
|  | 4 | +	OAuthAppSpec, | 
|  | 5 | +	OAuthFormStep, | 
|  | 6 | +	getOAuthLinks, | 
|  | 7 | +} from "~/lib/model/oauthApps/oauth-helpers"; | 
|  | 8 | +import { assetUrl } from "~/lib/utils"; | 
|  | 9 | + | 
|  | 10 | +const schema = z.object({ | 
|  | 11 | +	clientID: z.string().min(1, "Client ID is required"), | 
|  | 12 | +	clientSecret: z.string().min(1, "Client Secret is required"), | 
|  | 13 | +}); | 
|  | 14 | + | 
|  | 15 | +const steps: OAuthFormStep<typeof schema.shape>[] = [ | 
|  | 16 | +	{ | 
|  | 17 | +		type: "markdown", | 
|  | 18 | +		text: | 
|  | 19 | +			"### Step 1: Access PagerDuty Integrations\n" + | 
|  | 20 | +			"- Log in to your PagerDuty account\n" + | 
|  | 21 | +			"- Click on 'Integrations' in the top navigation\n" + | 
|  | 22 | +			"- Select 'App Registration' from the dropdown menu\n" + | 
|  | 23 | +			"- Click '+ New App'", | 
|  | 24 | +	}, | 
|  | 25 | +	{ | 
|  | 26 | +		type: "markdown", | 
|  | 27 | +		text: | 
|  | 28 | +			"### Step 2: Create OAuth App\n" + | 
|  | 29 | +			"- Fill in the app details:\n" + | 
|  | 30 | +			"  - Name: Choose a name for your integration (e.g., 'Obot')\n" + | 
|  | 31 | +			"  - Description: Brief description of how you'll use Obot\n" + | 
|  | 32 | +			"- Under 'Authentication Type', select 'OAuth 2.0'\n" + | 
|  | 33 | +			"- Click 'Next'", | 
|  | 34 | +	}, | 
|  | 35 | +	{ | 
|  | 36 | +		type: "copy", | 
|  | 37 | +		text: getOAuthLinks("pagerduty").redirectURL, | 
|  | 38 | +	}, | 
|  | 39 | +	{ | 
|  | 40 | +		type: "markdown", | 
|  | 41 | +		text: | 
|  | 42 | +			"### Step 3: Configure OAuth Settings\n" + | 
|  | 43 | +			"- In the OAuth Configuration section:\n" + | 
|  | 44 | +			"- Copy and paste your Obot redirect URL (shown above) into the 'Redirect URLs' field\n" + | 
|  | 45 | +			"- Select the following required scopes:\n" + | 
|  | 46 | +			"  - incidents.read\n" + | 
|  | 47 | +			"  - incidents.write\n" + | 
|  | 48 | +			"  - users.read\n" + | 
|  | 49 | +			"- Click 'Register App'", | 
|  | 50 | +	}, | 
|  | 51 | +	{ | 
|  | 52 | +		type: "markdown", | 
|  | 53 | +		text: | 
|  | 54 | +			"### Step 4: Get Your App Credentials\n" + | 
|  | 55 | +			"- After saving, you'll see your app's 'OAuth 2.0 Client Information'\n" + | 
|  | 56 | +			"- Copy the 'Client ID' and 'Client Secret'\n" + | 
|  | 57 | +			"- Enter these values in the fields below\n" + | 
|  | 58 | +			"- Download the 'Client Credentials' file and save it in a secure location", | 
|  | 59 | +	}, | 
|  | 60 | +	{ | 
|  | 61 | +		type: "input", | 
|  | 62 | +		input: "clientID", | 
|  | 63 | +		label: "Client ID", | 
|  | 64 | +	}, | 
|  | 65 | +	{ | 
|  | 66 | +		type: "input", | 
|  | 67 | +		input: "clientSecret", | 
|  | 68 | +		label: "Client Secret", | 
|  | 69 | +		inputType: "password", | 
|  | 70 | +	}, | 
|  | 71 | +]; | 
|  | 72 | + | 
|  | 73 | +export const PagerDutyOAuthApp = { | 
|  | 74 | +	schema, | 
|  | 75 | +	alias: "pagerduty", | 
|  | 76 | +	type: "pagerduty", | 
|  | 77 | +	displayName: "PagerDuty", | 
|  | 78 | +	logo: assetUrl("/assets/pagerduty_logo.svg"), | 
|  | 79 | +	steps: steps, | 
|  | 80 | +} satisfies OAuthAppSpec; | 
0 commit comments