Edits history of script submission #20172 for ' Delete a spike protection notification action (sentry)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Delete a spike protection notification action
     * Deletes a Spike Protection Notification Action.
    
    Notification Actions notify a set of members when an action has been triggered through a notification service such as Slack or Sentry.
    For example, organization owners and managers can receive an email when a spike occurs.
     */
    export async function main(auth: RT.Sentry, action_id: string) {
    	const url = new URL(
    		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/notifications/actions/${action_id}/`
    	)
    
    	const response = await fetch(url, {
    		method: 'DELETE',
    		headers: {
    			Authorization: 'Bearer ' + auth.token
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.text()
    }
    

    Submitted by hugo697 235 days ago