Connecting Microsoft Logic Apps and Flow to the Blackbaud CRM API

Microsoft Logic Apps and Flow

Important! All new integrations should be built on Blackbaud SKY APIs.  The documentation contained on these pages is to be used for reference only. 
SKY APIs are available to BBCRM customers as of service pack 33 hotfix 1 for Blackbaud-hosted customers and service pack 35 for all other customers.   SKY APIs are REST APIs that offer the same endpoints as the original REST APIs but also so much more.  Some added benefits of SKY APIs include: 
 

Microsoft has two cloud based orchestration services that can be used to schedule or automate tasks and to integrate apps and systems. Logic Apps is an Azure service that can only be used with an Azure subscription and is mainly aimed at an IT pro or developer audience. Flow is built on top of Logic Apps and comes with most Office 365 subscriptions. Flow is designed more for power users as opposed to professional developers and it has built in integration with Microsoft Power Apps. The examples shown here were created in Logic Apps, but the same integrations will work in Flow.

Connecting the CRM API to Logic Apps

Logic Apps are composed of actions that provide capabilities to connect to other services, create data in Office, schedule tasks and many others. The CRM API can be used in Logic Apps by creating HTTP actions that connect to an API operation such as constituent POST (add a constituent). Logic Apps are built using a design surface that provides an easy way to visually create integrations.

Many actions are available to users in the design surface that connect to common services such as Gmail, Salesforce, and Dropbox along with many Microsoft specific actions such as Excel, Outlook, and SQL Server. We'll review an app that uses the Eventbrite connector and a standard HTTP connector to connect CRM to Eventbrite.

Example Logic App

To illustrate how a Logic App can be used to connect CRM to a cloud service, we'll build a simple app composed of two actions. The app first connects to [Eventbrite](https://www.eventbrite.com/) using an action built to notify when an event has been added. The second action will take the event data from Eventbrite and call the CRM API event add operation.

When creating a Logic App or Flow, the first step is normally a trigger.

Searching triggers for 'Eventbrite' shows connectors for working with event adds and updates.

For this example, we want to select the create event connector. This connector polls Eventbrite at set intervals to get data from any new events. An active Eventbrite account is a prerequisite and the free account allows access to their API. A prompt to log in to Eventbrite is displayed after selecting the create connector. After logging in, a few settings are displayed in the connector.

The Organizer dropdown should contain the username associated with the Eventbrite account. The Interval and Frequency fields provide scheduling capabilities and the parameter dropdown contains Start Time and Time Zone. The default schedule of polling every three minutes is used in our example.

After the Eventbrite connector is configured, an HTTP action is added as the next step. To do this, click the 'New step' button and select the 'Built-in' category of actions. One of the built-in selections is a group of HTTP actions.

When the HTTP group is selected, a list of three HTTP actions is displayed. Select the one titled 'HTTP'.

Selecting the action displays fields for the HTTP method, url, and other parameters. To create events in CRM, the action must post a message to the event add operation.

The CRM API portal has an example event post message that can be used as a template for the action message body. Data from the Eventbrite action is available as variables that can be used in the event CRM API message body.

The event operation message body has a number of fields that match fields returned from the Eventbrite action. The event message name, description, capacity, and times are created from Eventbrite variables.

Logic Apps provides an expression language that can be used to manipulate data. In our example, we need to get the event start and end times from datetime values. A datetime formatting function can be used to parse the hour and minute from the start and end times. The function is built using the 'Expression' tab to enter the formatDateTime function and the 'Dynamic content' tab to select the Eventbrite datetime field..

The text of the function to parse the event end minute is:

formatDateTime(triggerBody()?['end']?['utc'],'mm')

When the logic app is saved, it will begin polling Eventbrite for new events. The logic app will fire when it detects a new event has been added. A new event will be created in the CRM instance mapped to your subscription key. Logic Apps keeps a log of every run and the run data can be viewed in the Azure or Flow portals. The log provides raw data and error messages that can be useful for troubleshooting.

Any operation in the CRM API can be connected to Logic Apps or Flow using the HTTP action described in the example. The wide range of connectors and actions combined with the API offer many new possibilities for integrating with CRM.