create

View as MarkdownOpen in Claude

Create a new SWML script resource.

Request

Create Calling ScriptobjectRequired
Request body to create a SWML Script that handles inbound or outbound calls.
OR
Create Messaging ScriptobjectRequired
Request body to create a SWML Script that handles inbound SMS or MMS messages.

Response

idstringRequiredformat: "uuid"
Unique ID of the SWML Script.
project_idstringRequiredformat: "uuid"
Unique ID of the Project.
display_namestringRequired
Display name of the SWML 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.
swml_scriptobjectRequired
SWML Script data.

Response Example

Response
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project_id": "1313fe58-5e14-4c11-bbe7-6fdfa11fe780",
"display_name": "Reply Bot",
"type": "swml_script",
"created_at": "2024-05-06T12:20:00Z",
"updated_at": "2024-05-06T12:25:00Z",
"swml_script": {
"contents": {
"sections": {
"main": [
{
"reply": "Thanks for your message!"
}
]
},
"version": "1.0.0"
},
"display_name": "Reply Bot",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"request_url": "https://example.com/swml_script",
"script_type": "messaging"
}
}

Example

from signalwire.rest import RestClient
client = RestClient(
project="your-project-id",
token="your-api-token",
host="your-space.signalwire.com",
)
result = client.fabric.swml_scripts.create(
name="my-item",
)
print(f"Created: {result['id']}")