0
Remove Subscriber
One script reply has been approved by the moderators Verified
Created by hugo697 55 days ago Viewed 13 times
0
Submitted by hugo697 Typescript (fetch-only)
Verified 55 days ago
1
type Acumbamail = {
2
	authToken: string
3
}
4

5
export async function main(resource: Acumbamail, list_id: number, subscriber_email: string) {
6
	const endpoint = `https://acumbamail.com/api/1/deleteSubscriber/`
7

8
	const formData = new FormData()
9

10
	formData.append('auth_token', resource.authToken)
11
	formData.append('list_id', list_id.toString())
12
	formData.append('email', subscriber_email)
13

14
	const response = await fetch(endpoint, {
15
		method: 'POST',
16
		headers: {
17
			'Cache-Control': 'no-cache'
18
		},
19
		body: formData
20
	})
21

22
	if (!response.ok) {
23
		throw new Error(`HTTP error! status: ${response.status}`)
24
	}
25

26
	return { success: true }
27
}
28