How to connect to the ActiveCampaign API

I’m new to coding in general so forgive me if what I have is useless.

What I want to achieve is when a user fills in their email address on my page, they are added to my active campaign account. I had this operating previously using their embedded forms but the form simply didn’t load 50% of the time so our conversion rates dropped through the floor.

I have a landing page with a text input field (email) and a submit button connected to a database & dataset.

I’ve also had a go at connecting to the Active campaign API using the wix fetch function from a web module.

My thought process was to set up a web module that stores the URL for my activecampaign api as well as the secret key and then call that function from the front end in the page code.

Here is my back end code.

My front end code

import {getApiKey} from 'backend/ACKey'

$w.onReady( function() {
getApiKey()
} );

On the preview, I’m getting the error message “Fetch did not succeed” which I believe tells me that my HTTP request is being rejected by Active campaign. But I don’t know for sure.

Any advice on how I can make this API integration work would be highly appreciated!.

Thank you

You can read about how to access 3rd party services in the article Corvid: How to Access 3rd-Party Services with the Fetch API .

To see how this works, take a look at the Advanced examples , many of them access 3rd party services. A couple of good examples to start with are: Example: Using the Places API from Google Maps services and Example: Send email with the SendGrid REST interface .

You will also need to find out from the service provider how to access their API. They should be able to tell you the reason that the fetch failed.

Thanks Yisrael, I worked with the first article to get this far but have not seen any of the advanced examples so i will check those out to see if I can make it work.

I’ll have a chat with their support team to see if I can find out why it failed as well.

Thanks again.

Hi, if you managed to get the code working could you please show me? I need it too thank you very much

Carefully read the material that I linked to. That will give you a good start.

@yisrael-wix Ok but know the error of his code is more helpful