0

Import External Vetting Record

by
Published Apr 8, 2025

This operation can be used to import an external vetting record from a TCR-approved vetting provider. If the vetting provider confirms validity of the record, it will be saved with the brand and will be considered for future campaign qualification.

Script telnyx Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Telnyx = {
3
	apiKey: string
4
}
5
/**
6
 * Import External Vetting Record
7
 * This operation can be used to import an external vetting record from a TCR-approved
8
vetting provider. If the vetting provider confirms validity of the record, it will be
9
saved with the brand and will be considered for future campaign qualification.
10
 */
11
export async function main(
12
	auth: Telnyx,
13
	brandId: string,
14
	body: { evpId: string; vettingId: string; vettingToken?: string }
15
) {
16
	const url = new URL(`https://api.telnyx.com/v2/brand/${brandId}/externalVetting`)
17

18
	const response = await fetch(url, {
19
		method: 'PUT',
20
		headers: {
21
			'Content-Type': 'application/json',
22
			Authorization: 'Bearer ' + auth.apiKey
23
		},
24
		body: JSON.stringify(body)
25
	})
26
	if (!response.ok) {
27
		const text = await response.text()
28
		throw new Error(`${response.status} ${text}`)
29
	}
30
	return await response.json()
31
}
32