Creating connectors for your Logic Apps/Flow (Part 3 – More triggers)

So, let's recap: we had regular connectors, we had poll triggers. So, we're still missing the push triggers. A poll trigger needs to be polled regularly by the logic app to see if it can continue. A push trigger does not have to be polled, it will tell the logic app when it needs to continue, passing the necessary information. At this moment a push trigger needs to be called by a webhook-action. Your trigger needs two function : Subscribe and Unsubscribe. In the Webhook-action these functions will automatically be called when the Logic App starts or stops. The WebHook action needs to pass the callback-url to your Subscribe/Unsubscribe-action. This callback-url is the url your API app will call for starting the Logic App. Your functions should look like this : public static List subscriptions = new List();[HttpPost, Route("api/webhooktrigger/subscribe")]public HttpResponseMessage Subscribe([FromBody] string callbackUrl){ subscriptions.Add(callbackUrl); return Request.CreateResponse();}[HttpPost, Route("api/webhooktrigger/unsubscribe")]public HttpResponseMessage Unsubscribe([FromBody] string callbackUrl){ subscriptions.Remove(callbackUrl); return Request.CreateResponse();} .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } The idea is that you call back the logic apps using the list of subscriptions as this: using (HttpClient client = new HttpClient()){ foreach (string callbackUrl in subscriptions) await client.PostAsync(callbackUrl, @"{""trigger"":""fired""}", new JsonMediaTypeFormatter(), "application/json");} After this your Logic app continues. For using the pushtrigger you need a webhook-connector in your logic app. This needs to call the subscribe and unsubscribe-methods of your API App. For the body you need to pass the callback url.     But still it won't work. When going to the Trigger History you can find that you get a failure because of an error with the content-Type. It is simple to solve: Show the advanced options of your webhook-connector and add the content-type to your subscribe- and unsubscribe-headers as this: Problem solved !