{"id":3895,"date":"2018-04-27T10:45:00","date_gmt":"2018-04-27T18:45:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vsappcenter\/?p=3895"},"modified":"2019-02-16T15:30:20","modified_gmt":"2019-02-16T22:30:20","slug":"customize-your-workflow-notifications-with-app-center-and-azure-logic-apps","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/appcenter\/customize-your-workflow-notifications-with-app-center-and-azure-logic-apps\/","title":{"rendered":"Customize Your Workflow Notifications with App Center and Azure Logic Apps"},"content":{"rendered":"<p>Our customers love App Center because it provides them with a feature-rich Continuous Integration (CI) service that works for the most common scenarios. In many cases, developers need to extend a specific service or feature to make it fit into their existing workflow. As an API-first product, we try to either build these features, or provide an API that developers can plug in to other services to customize their workflow and achieve their specific scenario. <\/p>\n<p>When building an app, it&#8217;s important to stay in the know by getting continuous updates on what&#8217;s happening with your app. App Center offers integrations with popular collaboration tools including Microsoft Teams, Slack and others. In this post, I&#8217;ll show you how to extend Slack notifications to send automatic status updates for your UI tests, when they are ran part of App Center build process. While App Center doesn&#8217;t directly offer this functionality yet, we&#8217;ve built a proof of concept to demonstrate how this type of workflow can be achieved by plugging Azure Logic Apps into App Center. <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/logic-apps\/\" rel=\"noopener\" target=\"_blank\">Azure Logic Apps<\/a> allow connecting apps and services to automate workflows with little (or not at all) code written.<\/p>\n<p><img decoding=\"async\" src=\"\" alt=\"\" width=\"350\" class=\"aligncenter size-full wp-image-3935\" \/><\/p>\n<p>One use case we heard about from some customers is summed up as this: <em>&#8220;I use App Center for running builds in a continuous manner, and I run a suite of UI tests, using the device cloud offered in App Center, upon every successful build. I already get emails at each test completion. However, my team lives in Slack, and we want to have the result of tests posted in our dedicated Slack channel.&#8221;<\/em> Similar scenarios include posting a message to Microsoft Teams or to bug tracker systems; for instance, creating an issue for any failed test suite that&#8217;s blocking a release. <\/p>\n<h2>How it Works<\/h2>\n<p>I onboarded our <a href=\"https:\/\/github.com\/Microsoft\/appcenter-sampleapp-react-native\" rel=\"noopener\" target=\"_blank\">sample React Native app<\/a> to the build service in App Center by connecting its source code repository and triggering a build on the master branch at each push. Post build, a script triggers a test run via App Center Test service using the CLI. Once the tests are kicked off, the post-build script is also triggering the Logic App to monitor the test run. You can <a href=\"https:\/\/github.com\/Microsoft\/appcenter-build-scripts-examples\/blob\/master\/azure\/logic-apps\/appcenter-post-build.sh\" rel=\"noopener\" target=\"_blank\">see what a similar post build script looks like here<\/a> and read more details about build scripts in general in the <a href=\"https:\/\/docs.microsoft.com\/en-us\/appcenter\/build\/custom\/scripts\/\" rel=\"noopener\" target=\"_blank\">App Center documentation<\/a>.<\/p>\n<p>Upon kicking off the tests in App Center, the Logic App takes over and does the magic:<\/p>\n<p><img decoding=\"async\" src=\"\" alt=\"\" width=\"750\" class=\"aligncenter size-full wp-image-3915\" \/><\/p>\n<p>Step 1: The Logic App receives an HTTP request containing the test run properties. <\/p>\n<p>Step 2: Logic App posts that the tests are under way in the configured Slack channel. <\/p>\n<p>Step 3, 4: Logic App tracks when the tests are completed in App Center. <\/p>\n<p>Step 5: When the UI tests are completed, Logic App posts the results on Slack. <\/p>\n<p>If you want to try this workflow yourself, you can create a new Azure Logic App in your Azure subscription and <a href=\"https:\/\/github.com\/Microsoft\/appcenter-build-scripts-examples\/blob\/master\/azure\/logic-apps\/monitor-tests.json\" rel=\"noopener\" target=\"_blank\">use this snippet<\/a> to get started quickly. Keep in mind that you&#8217;ll need to add your Slack connection as an HTTP Webhook. <\/p>\n<p>Similar workflows can integrate with Microsoft Teams, to a custom webhook, or to any other endpoint. Need other customizations on your Continuous Integration and delivery workflows? Share them with using the live chat window in App Center. If you&#8217;re already using build scripts to customize your builds, share it with the community and open a Pull Request in the <a href=\"https:\/\/github.com\/Microsoft\/appcenter-build-scripts-examples\" rel=\"noopener\" target=\"_blank\">build scripts repository<\/a>!\n&nbsp;\n<a href=\"https:\/\/appcenter.ms\/signup\"><img decoding=\"async\" src=\"\" alt=\"Get started now button\" width=\"200\" class=\"aligncenter size-full wp-image-2585\" \/><\/a>\n&nbsp;\n&nbsp;\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Our customers love App Center because it provides them with a feature-rich Continuous Integration (CI) service that works for the most common scenarios. In many cases, developers need to extend a specific service or feature to make it fit into their existing workflow. As an API-first product, we try to either build these features, or [&hellip;]<\/p>\n","protected":false},"author":39,"featured_media":38034,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16],"tags":[],"class_list":["post-3895","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mobiledev"],"acf":[],"blog_post_summary":"<p>Our customers love App Center because it provides them with a feature-rich Continuous Integration (CI) service that works for the most common scenarios. In many cases, developers need to extend a specific service or feature to make it fit into their existing workflow. As an API-first product, we try to either build these features, or [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/posts\/3895","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/comments?post=3895"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/posts\/3895\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/media\/38034"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/media?parent=3895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/categories?post=3895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/tags?post=3895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}