Selecting specific fields to retrieve in Active Campaign API

Hello,

I’m trying to create a scenario that would periodically retrieve informations about each campaign I’m sending in Active Campaign and copy them in a google sheet.

From what I’ve seen, the Active Campaigns node doesn’t include much related to campaigns data so I have to make a http request.

I’m using the endpoint : https://{youraccountname}.api-us1.com/api/3/messages
as shown here : List all messages

My issue is that this request returns way too much information and I’m only interested in a few.

Specifically, I’m only interested in the “id”, “fromname” and “subject” fields.

I also know that the Active Campaign API doesn’t have the options to only retrieve a selection of fields. So if it’s possible to do it, it’ll have to be inside N8N.

Here’s the beginning of what the http request is returning in Json format :

[

{

“messages”: [

{

“userid”: “1”,

“ed_instanceid”: “0”,

“ed_version”: “1”,

“cdate”: “2023-07-26T04:32:46-05:00”,

“mdate”: “2023-07-26T04:32:46-05:00”,

“name”: “”,

“fromname”: "Pierre ",

“fromemail”: “”,

“reply2”: “”,

“priority”: “3”,

“charset”: “utf-8”,

“encoding”: “quoted-printable”,

“format”: “mime”,

“subject”: “Votre confirmation de désabonnement”,

“preheader_text”: “”,

“text”: “Bonjour %FULLNAME%, Il s’agit d’un e-mail de confirmation vous permettant de connaître votre mise à jour d’abonnement à notre liste de diffusion %LISTNAME% Vous vous êtes désabonné pour ne plus recevoir d’e-mails.”,

“html”: "body”

“htmlfetch”: “now”,

“textfetch”: “now”,

“hidden”: “0”,

“preview_mime”: “”,

“preview_data”: null,

“has_predictive_content”: “0”,

“links”: {

“user”: "

},

“id”: “1”,

“user”: “1”

},

{

“userid”: “1”,

“ed_instanceid”: “0”,

“ed_version”: “1”,

“cdate”: “2023-07-26T04:32:46-05:00”,

“mdate”: “2023-07-26T04:32:46-05:00”,

“name”: “”,

“fromname”: "Pierre ",

“fromemail”: “”,

“reply2”: “”,

“priority”: “3”,

“charset”: “utf-8”,

“encoding”: “quoted-printable”,

“format”: “mime”,

“subject”: “Mettez à jour votre abonnement vers %LISTNAME%”,

“preheader_text”: “”,

“text”: " Mettre à jour vos informations d’abonnement à %LISTNAME%

“htmlfetch”: “now”,

“textfetch”: “now”,

“hidden”: “0”,

“preview_mime”: “”,

“preview_data”: null,

“has_predictive_content”: “0”,

“links”: {

“user”: “”

},

“id”: “2”,

“user”: “1”

},

And this is only the first 2 “messages”, there’s 854 of them + my goal is that the automation runs once every day to retrieve new campaigns data.

So I’m wondering if there’s a way that I can only filters the “id”, “fromname” and “subject” fields for each campaigns so it’s the only data imported in my google sheets.

I can’t seem to make it works…

Thank you very much,

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
  • n8n version: : 1.39.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): : Docker
  • Operating system: MacOS

Hey @Pierre_L,

Welcome to the community :raised_hands:

It really depends on if the api supports only returning the fields you are after, in some nodes where we have the option we still fetch everything but internally we will remove the other records.

In this case if the api doesn’t do it you may need to use a set node to only keep the fields you are interested in.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.