Search code examples
appveyor

Notification Templating with WebHooks default payload (Appveyor)


So currently I am in the process of setting up notifications, and what I had wanted to send in my message portion was the url for the artifact zip file that was created.

I took a look at the default payload (https://www.appveyor.com/docs/notifications/#webhook-payload-default) and was able to send {{jobs}} which gave me in the email this: System.Collections.Generic.List`1[Appveyor.Models.BuildJobNotificationTemplateData]

I figured I could traverse this in my messaging template. However, when I tried to do that it kept erroring out with different methods that I’ve tried.

Some of them include :

           {{jobs[0].artifacts[0].url}}
            {{jobs.artifacts.url}}
            {{eventData.jobs.artifacts.url}}
            {{eventData.jobs[0].artifacts[0].url}}
            Etc…

What would the proper syntax be to grab the first artifacts url using the templating engine?


Solution

  • This syntax will work (see mustache template to understand the syntax)

    <p>Artifacts:</p>
        <ul>
        {{#jobs}}
          {{#artifacts}}
            <li>{{url}}</li>
          {{/artifacts}}
        {{/jobs}}
        </ul>
    

    But unfortunately it will return temporary Azure blob storage URL, which will expire in 60 minutes. Please watch https://github.com/appveyor/ci/issues/1646. For now to get permanent URL please use this workaround