create

View as MarkdownOpen in Claude

Create a new cXML script resource.

Request

display_namestringRequired
Display name of the cXML Script
contentsstringRequired
The cXML script contents
status_callback_urlstringOptionalformat: "uri"
URL to send status callbacks to
status_callback_methodenumOptional
HTTP method to use for status callbacks
Allowed values:

Response

idstringRequiredformat: "uuid"
Unique ID of the cXML Script.
project_idstringRequiredformat: "uuid"
Unique ID of the Project.
namestringRequired
Display name of the cXML Script Fabric Resource
typeenumRequired
Type of the Fabric Resource
Allowed values:
created_atdatetimeRequired
Date and time when the resource was created.
updated_atdatetimeRequired
Date and time when the resource was updated.
cxml_scriptobjectRequired
cXML Script data.

Response Example

Response
{
"id": "993ed018-9e79-4e50-b97b-984bd5534095",
"project_id": "1313fe58-5e14-4c11-bbe7-6fdfa11fe780",
"name": "Reception Script",
"type": "cxml_script",
"created_at": "2024-05-06T12:20:00Z",
"updated_at": "2024-05-06T12:20:00Z",
"cxml_script": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"contents": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Say>Hello World</Say></Response>",
"request_count": 5,
"last_accessed_at": "2023-10-01T12:00:00Z",
"request_url": "https://example.signalwire.com/laml-bins/2537c89e-2606-48c2-b3c2-bb601d863d1e",
"script_type": "calling",
"display_name": "Booking Assistant Script",
"status_callback_url": "https://example.com/cxml/status",
"status_callback_method": "POST"
}
}

Example

import { RestClient } from "@signalwire/sdk";
const client = new RestClient({
project: "your-project-id",
token: "your-api-token",
host: "your-space.signalwire.com",
});
const result = await client.fabric.cxmlScripts.create({
display_name: "my-script",
contents: "<Response><Say>Hello</Say></Response>",
});
console.log(`Created: ${result.id}`);