import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const response = await client.phoneNumbers.jobs.updateEmergencySettingsBatch({
emergency_enabled: true,
phone_numbers: ['+19705555098', '+19715555098', '32873127836'],
});
console.log(response.data);{
"data": {
"id": "42587e44-3a3e-46de-9255-0c9a7a1d1ec7",
"record_type": "phone_numbers_job",
"status": "pending",
"type": "update_emergency_settings",
"etc": "2020-10-30T18:10:00.000Z",
"created_at": "2020-10-23T18:10:00.000Z",
"updated_at": "2020-10-23T18:10:01.000Z",
"phone_numbers": [
{
"id": "2637816387126861836"
},
{
"phone_number": "+19715555098"
},
{
"phone_number": "+19705555099"
},
{
"id": "3388768018273"
}
],
"successful_operations": [
{
"id": "2637816387126861836",
"phone_number": "+19705555098"
},
{
"id": "33081887126861836",
"phone_number": "+19715555098"
}
],
"pending_operations": [
{
"id": "2637816387126861837",
"phone_number": "+19705555099"
}
],
"failed_operations": [
{
"id": "3388768018273",
"phone_number": "+19705551234",
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The field is invalid.",
"source": {
"pointer": "/emergency_address_id"
}
}
]
}
]
}
}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.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const response = await client.phoneNumbers.jobs.updateEmergencySettingsBatch({
emergency_enabled: true,
phone_numbers: ['+19705555098', '+19715555098', '32873127836'],
});
console.log(response.data);{
"data": {
"id": "42587e44-3a3e-46de-9255-0c9a7a1d1ec7",
"record_type": "phone_numbers_job",
"status": "pending",
"type": "update_emergency_settings",
"etc": "2020-10-30T18:10:00.000Z",
"created_at": "2020-10-23T18:10:00.000Z",
"updated_at": "2020-10-23T18:10:01.000Z",
"phone_numbers": [
{
"id": "2637816387126861836"
},
{
"phone_number": "+19715555098"
},
{
"phone_number": "+19705555099"
},
{
"id": "3388768018273"
}
],
"successful_operations": [
{
"id": "2637816387126861836",
"phone_number": "+19705555098"
},
{
"id": "33081887126861836",
"phone_number": "+19715555098"
}
],
"pending_operations": [
{
"id": "2637816387126861837",
"phone_number": "+19705555099"
}
],
"failed_operations": [
{
"id": "3388768018273",
"phone_number": "+19705551234",
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The field is invalid.",
"source": {
"pointer": "/emergency_address_id"
}
}
]
}
]
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Array of phone number ids and/or phone numbers in E164 format to update
Indicates whether to enable or disable emergency services on the numbers.
Identifies the address to be used with emergency services. Required if emergency_enabled is true, must be null or omitted if emergency_enabled is false.
Phone numbers enable emergency requested.
Show child attributes
Identifies the resource.
"42587e44-3a3e-46de-9255-0c9a7a1d1ec7"
Identifies the type of the resource.
"phone_numbers_job"
Indicates the completion status of the background update.
pending, in_progress, completed, failed, expired "pending"
Identifies the type of the background job.
update_emergency_settings, delete_phone_numbers, update_phone_numbers "update_emergency_settings"
ISO 8601 formatted date indicating when the estimated time of completion of the background job.
ISO 8601 formatted date indicating when the resource was created.
ISO 8601 formatted date indicating when the resource was updated.
Show child attributes
The phone number in e164 format.
The phone number's ID
Show child attributes
"10007"
"Unexpected error"
"An unexpected error occured."
{
"id": "42587e44-3a3e-46de-9255-0c9a7a1d1ec7",
"record_type": "phone_numbers_job",
"status": "pending",
"type": "update_emergency_settings",
"etc": "2020-10-30T18:10:00.000Z",
"created_at": "2020-10-23T18:10:00.000Z",
"updated_at": "2020-10-23T18:10:01.000Z",
"phone_numbers": [
{ "id": "2637816387126861836" },
{ "phone_number": "+19715555098" },
{ "phone_number": "+19705555099" },
{ "id": "3388768018273" }
],
"successful_operations": [
{
"id": "2637816387126861836",
"phone_number": "+19705555098"
},
{
"id": "33081887126861836",
"phone_number": "+19715555098"
}
],
"pending_operations": [
{
"id": "2637816387126861837",
"phone_number": "+19705555099"
}
],
"failed_operations": [
{
"id": "3388768018273",
"phone_number": "+19705551234",
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The field is invalid.",
"source": { "pointer": "/emergency_address_id" }
}
]
}
]
}Was this page helpful?