//native
type Telnyx = {
apiKey: string
}
/**
* Update Verify profile
*
*/
export async function main(
auth: Telnyx,
verify_profile_id: string,
body: {
name?: string
webhook_url?: string
webhook_failover_url?: string
sms?: {
messaging_template_id?: string
app_name?: string
alpha_sender?: string
code_length?: number
whitelisted_destinations?: string[]
default_verification_timeout_secs?: number
}
call?: {
messaging_template_id?: string
app_name?: string
code_length?: number
whitelisted_destinations?: string[]
default_verification_timeout_secs?: number
}
flashcall?: {
whitelisted_destinations?: string[]
default_verification_timeout_secs?: number
}
language?: string
}
) {
const url = new URL(`https://api.telnyx.com/v2/verify_profiles/${verify_profile_id}`)
const response = await fetch(url, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 428 days ago