web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Custom API webhook tri...
Power Automate
Unanswered

Custom API webhook trigger - Delete calls not being made

(2) ShareShare
ReportReport
Posted on by 4

Hello All -

 

I followed the guide here, and got triggers working via webhooks - apart from the webhook delete calls. What exact criteria need to be met for delete to work? I have defined the delete call in the swagger doc, and have made sure to return a Location header in the 201 create request - and that request matches the pattern of the delete call I've defined. However, the delete call is not being made correctly. Can anyone help?

Cheers,
Matt

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I'm having the same issue 😄

  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @MattDendle1,

     

    Would you please share your OpenAPI here so that we could check if there is anything wrong?

     

    Regards,

    Mona

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @v-monli-msft!

     

    Thanks for your reply.

     

    Here is a link to the swagger document I used to create the webhooks (along with some API calls of our own).

     

    Again, the webhooks work fine - they get created, I return a 201 with a location header pointing at the location to be used with the delete verb. 

     

    Thanks for looking,

    Matt

  • mhueppin Profile Picture
    7 on at

    Any updates on this? I have the same issue. I return 201 with the Location Header set, delete method is defined in swagger.
    Does it need a specific name? or tag? Help is much appreciated.

    Cheers
    Marc

  • dynera34 Profile Picture
    2 on at

    I was struggling with this for a while but then I read the following text again: 

     

    The webhook creation response is required to specify a "Location" header, the value of which will be used to delete the webhook registration. You must define the path of the delete webhook request as an internal action.

     

    I then created an internal (hidden to end users) 'action' as part of the same custom connector. The idea is that the connector cannot make a call to an endpoint (the endpoint to delete/unsubscribe from the webhook) that is not registered. Once I created a DELETE action with the right URL structure, delete calls started to happen. 

     

    Hope this helps some folks.. 

  • MatthijsB Profile Picture
    8 on at

    Hello,

     

    This is still not working for me. The webhook is being subscribed without a problem, but never unsubscribes itself.

    I have a delete action on my REST controller and I tested it directly with the URL I add to the header when subscribing and the Rest call works. I add the following to the subscribe action: responseMessage.Headers.Add("Location", $"{host}/api/web-hook/delete/{id}");

     

    I also tried to add an internal action to my swagger file but still nothing (I also tried without the id as parameter but hardcoded to an old subsciption, still nothing):

     

    "/api/web-hook/delete/{id}": {
        "delete": {
            "responses": {
                "200": {
                    "description": "OK"
                }
            },
            "summary": "Delete WebHook",
            "description": "Delete the WebHook",
            "operationId": "DeleteWebHook",
            "x-ms-visibility": "internal",
            "parameters": [
                {
                    "name": "id",
                    "in": "path",
                    "required": true,
                    "type": "string",
                    "x-ms-visibility": "important",
                    "x-ms-url-encoding": "single",
                    "x-ms-summary": "ID",
                    "description": "Specify the ID of the WebHook"
                }
            ]
        }
    }

     

    EDIT:

    I changed it so that the ID is also hardcoded an not needed in the delete call (removed it from the response header and swagger) and I made the delete call on the REST API open for everyone and still nothing. Added logging on the first line of the method and the method doesn't even get called.

     

    Thanks in advanced!

    Matthijs

  • DmitriiKubyshev Profile Picture
    Microsoft Employee on at

    Hi folks,

    It looks like there is one missing requirements for webhook unsubscribe operations which must be authorized as other operation in a connector. Besides having DELETE operation in the connector swagger, Location header value must start with the registered backend service Url. So, if you have delete operation template in swagger:

    "/api/web-hook/delete/{id}" {"delete": {...}}

    and your connector's host is 'https://myhost.com' and your Base Url is '/restapi/v2', Location header must have the following value: 'https://myhost.com/restapi/v2/api/web-hook/delete/<some id>'

    Best regards,

    Dmitry

  • MatthijsB Profile Picture
    8 on at

    Hello Dmity,

     

    My location header value is exactly the same as my swagger delete operation URL, so this is not the problem.

     

    location header: https://myhost.azurewebsites.net/api/web-hook/delete/42 

     

    swagger host: myhost.azurewebsites.net

    swagger basePath: /

    swagger scheme: https

    swagger path: /api/web-hook/delete/{id}

     

    All the best,

    Matthijs

  • DmitriiKubyshev Profile Picture
    Microsoft Employee on at

    Hi MatthijsB,

    I think I found logs related to your connector and it looks like there is no Location header in a create webhook response.

    One such subscription request that was sent from the connector (2020-12-09): POST https://<yourhost>.azurewebsites.net/api/web-hook/create/DocumentPropertiesUpdated. The response was successful, but there was no Location header based on logs.

    I can also see few DELETE request, perhaps, it was a testing with direct action calls (webhookId=20). All of them failed with 415 status code, it looks like there is some payload passed along with those requests and Content-Type=text/plain.

     

    Best regards,

    Dmitry

  • MatthijsB Profile Picture
    8 on at

    Hello Dmitry,

     

    Yes I tried a few delete webhooks via the test section. All my deletes have a 415 error code in the test section of a custom connector. Even my delete document, while the flow action for this works perfectly (and is also already certified). as you can see in the provided delete action in the swagger I don't have any body parameters. I do have consumes and produces "application/json" on top level of my swagger file.

     

    My create webhook response does give a Location header as far as I can see:

    {
     "version": "1.1",
     "content": null,
     "statusCode": 200,
     "reasonPhrase": "OK",
     "headers": [
     {
     "key": "Location",
     "value": [
     "https://<myhost>.azurewebsites.net/api/web-hook/delete/45"
     ]
     }
     ],
     "trailingHeaders": [],
     "requestMessage": null,
     "isSuccessStatusCode": true
    }

     

    All the best,

    Matthijs

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 552

#2
Valantis Profile Picture

Valantis 388

#3
11manish Profile Picture

11manish 375

Last 30 days Overall leaderboard