Adding Mautic to Microsoft Flow

Bart van der Meeren
4 min readAug 21, 2018

--

Creating integrations between platforms can be quite the pain. Thats why platforms like Zapier and Microsoft Flow are this popular.

I use Flow, because I already have Office and Dynamics 365, which includes a premium license for Flow. If you’re not a Microsoft customer, you can use Flow for free (up to 2000 runs/month). However, it does not have custom connectors.

Custom Connectors

Although Flow has a lot of default connectors, chances are, your application is not available. For this, custom connectors are available.

Easiest way to add a custom connector, is using Postman collections. A collection of predefined API calls, using the Postman app.

Add Mautic to Postman

When you open Postman, first you start with adding a request, for instance Create Contact. (Read more about the Mautic API on https://developer.mautic.org/#rest-api)

First you change the request type to POST, as Mautic documentation describes it, and the request URL (use your own domain).

Then you add OAuth 2.0 as a Authorization type and click Get New Access Token.

Go to Mautic and create API keys and add the callback URI https://www.getpostman.com/oauth2/callback.

You copy the token name, Client ID and Client Secret to the new access token and use to Auth URL and Access Token URL below (with your own domain off course).

Click request token. A pop-up will open, prompting you to login in Mautic.

Click Use Token to get started

Go to Headers and add Content-Type application/json.

Go to Body and choose raw.

Add the following data to fill all contacts fields. You can use slugs of custom fields as well.

{
“id”: null,
“verifiedemail”: false,
“title”: null,
“firstname”: null,
“lastname”: null,
“company”: null,
“position”: null,
“email”: null,
“mobile”: null,
“phone”: null,
“points”: null,
“fax”: null,
“address1”: null,
“address2”: null,
“city”: null,
“state”: null,
“zipcode”: null,
“country”: null,
“preferred_locale”: null,
“attribution_date”: null,
“attribution”: null,
“website”: null,
“facebook”: null,
“foursquare”: null,
“googleplus”: null,
“instagram”: null,
“linkedin”: null,
“skype”: null,
“twitter”: null
}

If you change “email”: null to “email”: “info@test.com” and press the big blue Send button in the top right, you’ve just created a contact with that e-mail address in your Mautic app.

Click Save to complete this request.

Exporting the postman collection to Microsoft Flow

On the collection you’ve made, click menu and Export. Choose Collection V1.

Go to Microsoft Flow, click Custom Connectors and import a Postman collection, as shown at the top of this page.

You can complete the information on the first page and go to Security, where you should repeat the step you took in Postman. Go to Mautic, copy the set of API keys you’ve just used and save the Flow Connector by clicking Create Connector. The redirection URL will than be available. Copy that from Flow to Mautic and save the keyset in Mautic.

Go to the Definition page and immediately go to the Test page. Here you should click +New Connection. A pop-up will open, prompting you to login in Mautic. After this, you will see your connection filled in and selected.

Fill in the fields you see in the Create Contact view and click Test Operation.

If everything is as it should be, you just created a contact in your Mautic instance and you can add Mautic as a Action in Microsoft Flow.

Need any help?

Got any questions? Please comment or tweet me at MajesteitBart.

--

--