This session will explore a mobile app that can read NFC tags embedded in conference badges, and then translate those to sales leads stored directly in popular SaaS CRM providers. To accomplish this, we will see how to build a custom Push Trigger API App for a Logic App, and then how to invoke a callback from a mobile device. We will also configure the Logic App to receive device events and provide integration with SaaS applications such as Salesforce. Once we have the basics established, we'll dip briefly into the world of Windows IoT to explore a push-button push trigger.
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Building Push Triggers for Logic Apps
1. Sponsored & Brought to you by
Building Push Triggers for Logic Apps
Nicholas Hauenstein
http://www.twitter.com/nickhauenstein
https://www.linkedin.com/in/nickhauenstein
2. Building Push
Triggers for Logic
Apps
Nick Hauenstein
Microsoft Integration MVP
Principal Software Development Engineer, QuickLearn Training
@nickhauenstein
3. About Me
Nick Hauenstein nickh@quicklearn.com
17 years development experience
14 years .NET experience
Integration entry point: BizTalk Server 2006
Member of the ESB Toolkit 2.0 Team
Blogger (quicklearn.com/blog)
200+ pages on BizTalk Server 2013 & 2013 R2
Granted rights to display all these nifty icons:
6. After the Conference
1. Data is retrieved from device in CSV format
2. CSV file is emailed around
3. CSV file is eventually imported into CRM system
Technical Conference Exhibitor Experience
9. Evolution of the Smart Fridge
First Generation: Put a tablet in the door
Second Generation: No screen, adds
local device communication
Generation of Integration: Sensors,
social, offers
Sample “Experience”
Your favorite sports
team is playing
tomorrow and you
invited Alice and Bob
over, would you like to
get some more beer?
Yes.
Would you like a 6-pack
or a full case?
10. Two simple equations
Internet of Things = Smart Things
Internet of Things + Integration = Magic Things
What Happens When Integration Meets IoT?
11.
12. Microsoft Azure App Service
Logic Apps
Framework for building and
running cloud-hosted
workflows
Comprised of API Apps which
provide behaviors and
connections
Think adapters and pipeline
components
What Are Logic Apps?
13. During the Conference
1. Attendees approach booth
2. Attendees make eye contact
3. Exhibitor scans attendee badge (barcode, QR, NFC)
4. Scan data is sent to awaiting Logic App(s)
5. Logic App(s) create leads in CRM system
Leads qualified/disqualified based on publicly available
company data?
Targeted drip marketing campaign scheduled based on
date/GPS coordinates scanned?
Technical Conference “Experience”
15. How Do Push Triggers Work?
Push Trigger
API App
16. Imagine that we’re building the Azure equivalent of
a BizTalk Server Receive Adapter that receives data in
an event-driven fashion.
You Lost Me, What Am I Looking At?
19. Routes
Map inbound HTTP requests to methods that handle those
requests
Defined through class/method-level attributes
Controllers
Classes implementing API logic within methods designed to
handle incoming HTTP requests
May derive from ApiController*
Models
Classes that model the shape of API inputs/outputs
Key Components of a Web API Application
20. Exploring the Swashbuckle Configuration
SwaggerConfig.cs
Contains commented
documentation and
sample code inline to
guide you in emitting
appropriate swagger
metadata for your
operations
21. Logic App designer can natively consume Web APIs
Cards will show all possible operations
Operations and parameters may have unfriendly names
Operations and parameters will lack meaningful
descriptions
Metadata can be added to API Apps to make them
more friendly in the Logic Apps designer
The T-Rex Metadata Library NuGet package can help
Exposing Functionality to Logic Apps
22. Introducing the T-Rex Metadata Library
T-Rex Provides .NET
Attributes
Can be used to decorate
methods/parameters with
designer names and
descriptions
Can be used to indicate
triggers
T-Rex Provides Swashbuckle
Filters
Swashbuckle filters change
how swagger metadata is
generated so that it includes
data from .NET attributes
Source Code / Documentation
https://github.com/nihaue/trex
NuGet Package
http://www.nuget.org/packages/trex
24. Special Considerations for Push Triggers
Special metadata must be added to indicate a given
action is used for push callback registration
T-Rex Metadata Library provides the Trigger attribute
triggerId string input is expected as first parameter of
callback registration method
Contains the name of the requesting Logic App by default
Additional Steps Required for Building Triggers
25. Special Considerations for Push Triggers
TriggerInput<TInput, TOutput> is expected as
parameter of callback registration
Logic App provides requested callback configuration data
through this parameter
Logic App infers shape of incoming data through this parameter
Additional Steps Required for Building Triggers
26. Special Considerations for Push Triggers
Callback registration method is expected to return a
specific response
Azure App Service SDK provides
Request.PushTriggerRegistered extension method to assist
Additional Steps Required for Building Triggers
27. using Microsoft.Azure.AppService.ApiApps.Service;
using TRex.Metadata;
/* ... */
[Trigger(TriggerType.Push, typeof(SamplePushEventModel))]
[Metadata("Receive Simulated Push")]
[HttpPut, Route("{triggerId}")]
public HttpResponseMessage RegisterCallback(
string triggerId,
[FromBody]TriggerInput<SamplePushConfig, SamplePushEventModel> parameters)
{
/* ... */
}
Defining a Push Trigger Action Method
Trigger attribute causes metadata to be generated indicating
that this is the callback registration method for a push trigger
TriggerInput<TInput, TOutput> provides
shape of the input expected on the Logic App
designer card, and shape out push trigger output
28. // Notify the Logic App that the callback was registered
return Request.PushTriggerRegistered(parameters.GetCallback());
Responding That Push Trigger Callback Was Registered
PushTriggerRegistered extension
method creates appropriate
HttpResponseMessage indicating
callback registration was successful
29. Demo: Building an NFC Push Trigger
In this demonstration, you will see how to…
Read data from an NFC card in a Universal Windows App
Implement a Push Trigger
Invoke a Push Trigger Callback
31. Push-Button Push Trigger for Logic Apps
Parts Required to Build
http://www.amazon.co.uk/dp/B00T2U7R7I
http://www.amazon.co.uk/dp/B00L2X1X9Q
http://www.amazon.co.uk/dp/B00KBXTO26
http://www.amazon.co.uk/dp/B00976KDBY
Sample Code
http://bit.ly/1OOddFN
https://github.com/nihaue/PushButtonPushTrigger
32. Demo: Push-Button Push Trigger in Action
In this demonstration, you will see…
How to trigger a Logic App with the press of a button
33. Read the NFC Push Trigger Write-Up + Source Code
http://bit.ly/1Myimgz
Attend the Hackathon This Weekend
http://bit.ly/1Rjzo5N
Take a Class & Get Your Own Push-Button Push Trigger
http://bit.ly/1RR7H5l
Stay Tuned for the Push-Button Push Trigger Write-Up
http://bit.ly/1LjzWY5
What Now? Take a Photo of This Slide
Editor's Notes
It feels like there must be a better way, because the process described is stuck in the store and compute era
Store and Compute
Applications
Search and Browse
Web pages
Know and Do
Experiences
Source: https://channel9.msdn.com/Events/ALM-Summit/ALM-Summit-3/A-New-Era-of-Computing
James Whittaker, A New Era of Computing. Jan 30, 2013. ALM Summit 3 Conference
Fun integration ideas…
Relationship status on Facebook
You keep opening and closing the fridge without removing/adding items
The power goes out "the internal temperature dropped below X degrees, these items [] have probably spoiled and should be thrown out. Would you like me to replace them for $45?"
CONCEPT
PROCESS
http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api
* Up until ASP.NET 5, at which point the base class doesn’t matter
CONCEPT: Logic Apps will need help seeing the shape of the API