> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # List SWML webhooks GET https://%7BYour_Space_Name%7D.signalwire.com/api/fabric/resources/swml_webhooks Returns the project's SWML Webhook resources, whose configured servers return calling or messaging SWML for each request. Use it to discover dynamic SWML handlers before retrieving or changing one. Use [SWML Scripts](/docs/apis/rest/swml-scripts/list-swml-scripts) when the SWML should be stored in SignalWire instead. #### Permissions The API token used to authenticate must have the following scope(s) enabled to make a successful request: _Voice_, _Messaging_, _Fax_, or _Video_. [Learn more about API scopes](/docs/platform/your-signalwire-api-space). Reference: https://signalwire.com/docs/apis/rest/swml-webhook/list-swml-webhooks ## Authentication - `Authorization` header (basic auth, required) — SignalWire Basic Authentication using Project ID and API Token. The client sends HTTP requests with the Authorization header containing the word Basic followed by a space and a base64-encoded string of project_id:token. The project ID will be used as the username and the API token as the password. Example: ``` Authorization: Basic base64(project_id:token) ``` ## Response ### 200 The request has succeeded. - `data` (list of SWMLWebhookResponse, required) — An array of objects that contain a list of SWML Webhook data - `links` (SWMLWebhookPaginationResponse, required) — Object containing pagination links ## Errors ### 401 Unauthorized Error Access is unauthorized. - `error` (enum, required) - Allowed values: `Unauthorized` ### 404 Not Found Error The server cannot find the requested resource. - `error` (enum, required) - Allowed values: `Not Found` ### 500 Internal Server Error An internal server error occurred. - `error` (enum, required) - Allowed values: `Internal Server Error` ## Types ### SWMLWebhookResponse - `id` (string, required) — Unique ID of the SWML Webhook. - `project_id` (string, required) — Unique ID of the Project. - `display_name` (string, required) — Display name of the SWML Webhook Fabric Resource - `type` (enum, required) — Type of the Fabric Resource - Allowed values: `swml_webhook` - `created_at` (datetime, required) — Date and time when the resource was created. - `updated_at` (datetime, required) — Date and time when the resource was updated. - `swml_webhook` (SWMLWebhook, required) — SWML Webhook data. ### SWMLWebhookPaginationResponse - `self` (string, required) — Link of the current page - `first` (string, required) — Link to the first page - `next` (string, optional) — Link to the next page - `prev` (string, optional) — Link to the previous page ### SWMLWebhook - `id` (string, required) — Unique ID of the SWML Webhook. - `name` (string, required) — Name of the SWML Webhook. - `used_for` (enum, required) — Indicates whether this SWML Webhook handles inbound calls or inbound messages. Determines the payload SignalWire POSTs to `primary_request_url`. - Allowed values: `calling`, `messaging` - `primary_request_url` (string, required) — Primary URL SignalWire fetches the SWML document from when the webhook fires. The webhook payload depends on `used_for`: for `calling`, see the [SWML inbound call webhook](/docs/apis/rest/webhooks/inbound-call-webhook); for `messaging`, see the [SWML inbound message webhook](/docs/apis/rest/webhooks/inbound-message-webhook). - `primary_request_method` (enum, required) — Primary request method of the SWML Webhook. - Allowed values: `GET`, `POST` - `fallback_request_url` (string, required, nullable) — Fallback URL SignalWire fetches the SWML document from if the primary URL fails. Receives the same payload as `primary_request_url` — see the [SWML inbound call webhook](/docs/apis/rest/webhooks/inbound-call-webhook) or [SWML inbound message webhook](/docs/apis/rest/webhooks/inbound-message-webhook) depending on `used_for`. - `fallback_request_method` (enum, required) — Fallback request method of the SWML Webhook. - Allowed values: `GET`, `POST` - `status_callback_url` (string, required, nullable) — URL to receive message status callback events for outbound messages sent by this webhook (`reply` or `send_sms`). See the [Message status callback](/docs/apis/rest/webhooks/message-status-callback) webhook for the payload your URL will receive. - `status_callback_method` (enum, required) — Status callback method of the SWML Webhook. - Allowed values: `GET`, `POST` ## Examples **Response** ```json { "data": [ { "id": "a87db7ed-8ebe-42e4-829f-8ba5a4152f54", "project_id": "99151cf8-9548-4860-ba70-a8de824f3312", "display_name": "Booking Assistant", "type": "swml_webhook", "created_at": "2024-05-06T12:20:00Z", "updated_at": "2024-05-06T12:20:00Z", "swml_webhook": { "id": "a87db7ed-8ebe-42e4-829f-8ba5a4152f54", "name": "My SWML Webhook", "used_for": "calling", "primary_request_url": "https://primary.com", "primary_request_method": "GET", "fallback_request_url": "https://fallback.com", "fallback_request_method": "GET", "status_callback_url": "https://callback.com", "status_callback_method": "POST" } } ], "links": { "self": "https://example.signalwire.com/api/fabric/resources/swml_webhooks?page_number=0&page_size=50&type=swml_webhook", "first": "https://example.signalwire.com/api/fabric/resources/swml_webhooks?page_number=0&page_size=50&type=swml_webhook", "next": "https://example.signalwire.com/api/fabric/resources/swml_webhooks?page_number=1&page_size=50&page_token=PAbff61159-faab-48b3-959a-3021a8f5beca&type=swml_webhook", "prev": "https://example.signalwire.com/api/fabric/resources/swml_webhooks?page_number=0&page_size=50&page_token=PAbff61159-faab-48b3-959a-3021a8f5beca&type=swml_webhook" } } ``` **SDK Code** ```python import requests url = "https://{your_space_name}.signalwire.com/api/fabric/resources/swml_webhooks" response = requests.get(url, auth=("", "")) print(response.json()) ``` ```javascript const url = 'https://{your_space_name}.signalwire.com/api/fabric/resources/swml_webhooks'; const credentials = btoa(":"); const options = {method: 'GET', headers: {Authorization: `Basic ${credentials}`}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://{your_space_name}.signalwire.com/api/fabric/resources/swml_webhooks" req, _ := http.NewRequest("GET", url, nil) req.SetBasicAuth("", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://{your_space_name}.signalwire.com/api/fabric/resources/swml_webhooks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request.basic_auth("", "") response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://{your_space_name}.signalwire.com/api/fabric/resources/swml_webhooks") .basicAuth("", "") .asString(); ``` ```php request('GET', 'https://{your_space_name}.signalwire.com/api/fabric/resources/swml_webhooks', [ 'headers' => [ ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://{your_space_name}.signalwire.com/api/fabric/resources/swml_webhooks"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let credentials = Data(":".utf8).base64EncodedString() let headers = ["Authorization": "Basic \(credentials)"] let request = NSMutableURLRequest(url: NSURL(string: "https://{your_space_name}.signalwire.com/api/fabric/resources/swml_webhooks")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```