//native
type Telnyx = {
apiKey: string
}
/**
* Update the emergency settings from a batch of numbers
* Creates a background job to update the emergency settings of a collection of phone numbers. At most one thousand numbers can be updated per API call.
*/
export async function main(
auth: Telnyx,
body: {
phone_numbers: string[]
emergency_enabled: false | true
emergency_address_id: string
}
) {
const url = new URL(`https://api.telnyx.com/v2/phone_numbers/jobs/update_emergency_settings`)
const response = await fetch(url, {
method: 'POST',
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