# Send a webhook to a webhook listener POST https://api.moveworks.ai/webhooks/v1/listeners/{listener_id}/notify Content-Type: application/json Sends a webhook to a webhook listener. The listener must be defined in Agent Studio. Reference: https://docs.moveworks.com/api-reference/webhook-listeners/webhooks/send-a-webhook-to-a-webhook-listener ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Send a webhook to a webhook listener version: endpoint_webhooks.sendAWebhookToAWebhookListener paths: /webhooks/v1/listeners/{listener_id}/notify: post: operationId: send-a-webhook-to-a-webhook-listener summary: Send a webhook to a webhook listener description: >- Sends a webhook to a webhook listener. The listener must be defined in Agent Studio. tags: - - subpackage_webhooks parameters: - name: listener_id in: path description: The unique identifier of the webhook listener. required: true schema: type: string format: uuid - name: Authorization in: header description: API Key in the form of a JWT Bearer token. required: true schema: type: string responses: '200': description: OK. The event was received successfully by the listener. content: application/json: schema: $ref: >- #/components/schemas/Webhooks_sendAWebhookToAWebhookListener_Response_200 '401': description: Unauthorized. The request lacks valid authentication credentials. content: {} '404': description: >- Not Found. The specified listener_id does not exist. The response body is empty. content: {} requestBody: description: The arbitrary JSON payload to send to the webhook listener. content: application/json: schema: type: object additionalProperties: description: Any type components: schemas: Webhooks_sendAWebhookToAWebhookListener_Response_200: type: object properties: message: type: string description: A confirmation message. status: type: string description: The status of the event receipt. ``` ## SDK Code Examples ```python Webhooks_sendAWebhookToAWebhookListener_example import requests url = "https://api.moveworks.ai/webhooks/v1/listeners/listener_id/notify" payload = { "event_type": "incident.created", "data": { "incident_id": "INC0123456", "priority": "High", "short_description": "Email server is down." } } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Webhooks_sendAWebhookToAWebhookListener_example const url = 'https://api.moveworks.ai/webhooks/v1/listeners/listener_id/notify'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"event_type":"incident.created","data":{"incident_id":"INC0123456","priority":"High","short_description":"Email server is down."}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Webhooks_sendAWebhookToAWebhookListener_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.moveworks.ai/webhooks/v1/listeners/listener_id/notify" payload := strings.NewReader("{\n \"event_type\": \"incident.created\",\n \"data\": {\n \"incident_id\": \"INC0123456\",\n \"priority\": \"High\",\n \"short_description\": \"Email server is down.\"\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Webhooks_sendAWebhookToAWebhookListener_example require 'uri' require 'net/http' url = URI("https://api.moveworks.ai/webhooks/v1/listeners/listener_id/notify") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"event_type\": \"incident.created\",\n \"data\": {\n \"incident_id\": \"INC0123456\",\n \"priority\": \"High\",\n \"short_description\": \"Email server is down.\"\n }\n}" response = http.request(request) puts response.read_body ``` ```java Webhooks_sendAWebhookToAWebhookListener_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.moveworks.ai/webhooks/v1/listeners/listener_id/notify") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"event_type\": \"incident.created\",\n \"data\": {\n \"incident_id\": \"INC0123456\",\n \"priority\": \"High\",\n \"short_description\": \"Email server is down.\"\n }\n}") .asString(); ``` ```php Webhooks_sendAWebhookToAWebhookListener_example request('POST', 'https://api.moveworks.ai/webhooks/v1/listeners/listener_id/notify', [ 'body' => '{ "event_type": "incident.created", "data": { "incident_id": "INC0123456", "priority": "High", "short_description": "Email server is down." } }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Webhooks_sendAWebhookToAWebhookListener_example using RestSharp; var client = new RestClient("https://api.moveworks.ai/webhooks/v1/listeners/listener_id/notify"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"event_type\": \"incident.created\",\n \"data\": {\n \"incident_id\": \"INC0123456\",\n \"priority\": \"High\",\n \"short_description\": \"Email server is down.\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Webhooks_sendAWebhookToAWebhookListener_example import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "event_type": "incident.created", "data": [ "incident_id": "INC0123456", "priority": "High", "short_description": "Email server is down." ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.moveworks.ai/webhooks/v1/listeners/listener_id/notify")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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() ```