top of page
Writer's picturePatrick Cooley

How to Use Power Automate to Create a Link to ActiveCampaign

Updated: Jul 21


I didn’t know how to build a custom connector using the HTTP step in Power Automate, I wanted to see an example of what someone had already done. Unfortunately, I couldn’t find where someone had bridged that chasm before. Fortunately, I had the encouragement from Shane Young that I could do it, and examples from so many others, that I didn’t give up! I want to encourage you that you can do it, too, and I want to share with you an example of an HTTP connection to ActiveCampaign.


My problem was that I had to create a custom connector to add contacts to ActiveCampaign. Like I said, though, I just couldn’t find an example posted where someone did this with Power Automate.


Find settings & documentation

The first thing I did (and you should always consider this as your first step, too!) was check with Microsoft Copilot on how to continue. Copilot gave me generic steps as well as the link to some API documentation from ActiveCampaign.  There is some some good documentation (ActiveCampaign API documentation) for programmers on how to do this, however, there’s nothing in there that’s specific to Power Automate. So, I had to put on my thinking cap for this one.

The next thing I did was to log into my account to get the critical information to put into my flow. This included the Method, URL, Headers, Body, and Authentication. Unfortunately, the API documentation didn’t lay it out like this, so I had to do some trial and error to get it working.


The Method was straightforward, I needed to do a POST, because I was going to create a new entry.


The URI was a bit trickier, and that’s where the documentation was helpful. The way it’s laid out gives you a menu down the left side with some of the different actions you can do. In my case, I needed to “Create a contact”. I scrolled down the list until I saw “Contacts” and then expanded it, revealing a way to “Create a contact”. As you can see from the image below, I was able to glean some information on the Method, URL, some Headers, and some JSON for the Body.



So, at this point, I had the Method, the URL, and some JSON to help with the Body. I had a clue that I was going to need an Api-Token in the Header, but I didn’t know exactly what that meant. Also, I noticed that the code below the URL part (in the image as a “CURL REQUEST”) included two other headers: accept and content-type; both or type application/json. Did I need those in my flow? I didn’t know, but I made a note of them.


To find the rest of what I needed, I had to log into my ActiveCampaign account. Once you’re logged in to your account, you can go to the Settings > Developer to find what you need for the Api-Token for the Header. The information you’re looking for to complete your specific URL as well as the Api-Token part are on this page. The URL is what you replace “youraccountname” from the documentation with. The Key becomes the value for the Header “Api-Token”.



Though the Settings didn’t tell me everything that I needed for Power Automate, I also had my login information for ActiveCampaign.


At this point, I actually had everything that I needed, and I was ready to begin my flow.


Create the flow in Power Automate

So as not to break my production flow while I was figuring this out, I created a test flow with two simple steps, a manual trigger and an HTTP step.

The three pieces of information that I wanted to pass to my HTTP connector were:

  • First Name

  • Last Name

  • Email address

So, I made these manual inputs for my test flow, and I added an HTTP step to my flow. The tricky part was finding out where to put the Key that I copied from my ActiveCampaign account, but here’s how it all worked:

Method: POST

URL: [my account URL from the Developer info]/api/3/contacts

Headers:

                Api-Token [the copied Key from the Developer info]

                content-type    application/json

                accept             application/json

The only information that I wanted to send to my ActiveCampaign Contacts list was an email, and a first name and last name. So, I restructured the JSON for my request Body like this:

Body:

                {

                 "contact": {

                 "email": “[the dynamic email input from my trigger]”

                 "firstName": “[the dynamic First name input from my trigger]”

                 "lastName": “[the dynamic Last name input from my trigger]”

                  }

}




I went through some trial and error with the Authentication (under Advanced options), but what worked was Basic authentication with the Username and Password from my account.

Here’s what the final test flow looked like:



With these settings, I was able to successfully add a contact to my ActiveCampaign contacts list. With the test flow working, I then went back and changed my production flow.


Summary

Building a custom connector with Power Automate is possible with the HTTP connector! Though I’d never successfully done this before, I want to encourage you that you can do it! Don’t be intimidated by the crazy JSON that you must write and all the Headers and Authentication that you need to include. Find API documentation from the site/service you’re trying connect with (use Copilot for an early assist), build a small test flow, and experiment with the puzzle pieces until you get it to work. When it works, it’s oh so satisfying!

229 views0 comments

Recent Posts

See All

Comentários


bottom of page