Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andreas Emtinger 23 posts 185 karma points
    Sep 10, 2020 @ 19:54
    Andreas Emtinger
    0

    Umbraco 8 (Cloud) - WebHook Code Example

    Hi,

    I trying to use "Post deployment webhooks" in Umbraco Cloud. Do anyone have an working code example?

    My code:

    public class WebHooksController : UmbracoApiController
    {
        [System.Web.Http.HttpPost]      
        public string Deploy(UmbracoDeployPayload payload)
        {
            Logger.Info<WebHooksController>("WebHook - Deployed");
            return "message";
        }
    
        public class UmbracoDeployPayload
        {
            public string Id { get; set; }
            public string Status { get; set; }
            public string StatusText { get; set; }
            public string AuthorEmail { get; set; }
            public string Author { get; set; }
            public string Message { get; set; }
            public string Progress { get; set; }
            public DateTime ReceivedTime { get; set; }
            public DateTime StartTime { get; set; }
            public DateTime EndTime { get; set; }
            public DateTime LastSuccessEndTime { get; set; }
            public bool Complete { get; set; }
            public string ProjectName { get; set; }
            public string ProjectUrl { get; set; }
            public string SiteUrl { get; set; }
            public string EnvironmentName { get; set; }
            public List<UmbracoDeployCommit> Commits { get; set; }
        }
    
        public class UmbracoDeployCommit
        {
            public string AuthorName { get; set; }
            public string AuthorEmail { get; set; }
            public string Message { get; set; }
            public DateTime Timestamp { get; set; }
            public List<string> ChangedFiles { get; set; }
        }
    }
    

    My api is not called after I pushed new code. I cant see any logging. I can test my API with Postman, so I know that my API is working.

    Documentation only have example on json data: https://our.umbraco.com/documentation/Umbraco-Cloud/Deployment/Deployment-Webhook/

    Please help :)

  • Andreas Emtinger 23 posts 185 karma points
    Sep 27, 2020 @ 22:14
    Andreas Emtinger
    0

    So, my code works. The problem was that my site use IP-allowlisting. And Umbraco Cloud have more IP addresses than documentation says :)

Please Sign in or register to post replies

Write your reply to:

Draft