webhook
Orchestrate uses webhooks to notify your application when an event occurs in your account. Webhooks provide an asynchronous means of communication.
How to receive webhook notifications
Step 1: Configure your webhook URL on the Orchestrate Dashboard.
You can configure your webhook URL on the orchestrate dashboard by going to settings>developers>webhooks.

Step 2: Listen for events
Build a HTTP handler that listens for events coming from Orchestrate.
const express = require('express');
const app = express();
app.post('/myapp/webhook', express.json({type: 'application/json'}), (request, response) => {
const event = request.body;
console.log(event)
response.json({success: true});
});
http.HandleFunc("/webhook", func(w http.ResponseWriter, req *http.Request) {
const MaxBodyBytes = int64(65536)
req.Body = http.MaxBytesReader(w, req.Body, MaxBodyBytes)
payload, err := ioutil.ReadAll(req.Body)
if err != nil {
w.WriteHeader(http.StatusServiceUnavailable)
return
}
event := map[string]interface{}
if err := json.Unmarshal(payload, &event); err != nil {
w.WriteHeader(http.StatusBadRequest)
return
}
fmt.Println(event)
w.WriteHeader(http.StatusOK)
})
Updated 11 months ago