0

Create or update an external issue

by
Published Oct 17, 2025

Create or update an external issue from an integration platform integration.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Create or update an external issue
4
 * Create or update an external issue from an integration platform integration.
5
 */
6
export async function main(auth: RT.Sentry, uuid: string, body: Body) {
7
	const url = new URL(
8
		`https://${auth.region}.sentry.io/api/0/sentry-app-installations/${uuid}/external-issues/`
9
	)
10

11
	const response = await fetch(url, {
12
		method: 'POST',
13
		headers: {
14
			'Content-Type': 'application/json',
15
			Authorization: 'Bearer ' + auth.token
16
		},
17
		body: JSON.stringify(body)
18
	})
19
	if (!response.ok) {
20
		const text = await response.text()
21
		throw new Error(`${response.status} ${text}`)
22
	}
23
	return await response.json()
24
}
25

26
/* eslint-disable */
27
/**
28
 * This file was automatically generated by json-schema-to-typescript.
29
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
30
 * and run json-schema-to-typescript to regenerate this file.
31
 */
32

33
export interface Body {
34
	/**
35
	 * The ID of the Sentry issue to link the external issue to.
36
	 */
37
	issueId: number
38
	/**
39
	 * The URL of the external service to link the issue to.
40
	 */
41
	webUrl: string
42
	/**
43
	 * The external service's project.
44
	 */
45
	project: string
46
	/**
47
	 * A unique identifier of the external issue.
48
	 */
49
	identifier: string
50
	[k: string]: unknown
51
}
52