SendGrid Get All Contacts Limited to 50?

Describe the issue/error/question

I am sending transactional emails via the SendGrid node (SendGrid node “get all contacts” → SendGrid node “Send mail”), recently the contacts in the contact list in SendGrid has passed 50, yet it seems to only ever get 50 contacts.

Thank you, struggling with SendGrid support, maybe you guys may understand better what’s going on.

What is the error message (if any)?

None, just doesn’t receive more contacts, then sends to all those that the node receives.

Please share the workflow

{
  "nodes": [
    {
      "parameters": {
        "resource": "contact",
        "operation": "getAll",
        "returnAll": true,
        "filters": {}
      },
      "name": "SendGrid Get All Contacts",
      "type": "n8n-nodes-base.sendGrid",
      "typeVersion": 1,
      "position": [
        1230,
        -30
      ],
      "credentials": {
        "sendGridApi": "Xyz SendGrid API"
      }
    },
    {
      "parameters": {
        "resource": "mail",
        "fromEmail": "xyz",
        "fromName": "abc",
        "toEmail": "={{$node[\"SendGrid Get All Contacts\"].json[\"email\"]}}",
        "dynamicTemplate": true,
        "templateId": "d-xyz",
        "dynamicTemplateFields": {
          "fields": []
        },
        "additionalFields": {}
      },
      "name": "SendGrid Send Mail",
      "type": "n8n-nodes-base.sendGrid",
      "typeVersion": 1,
      "position": [
        1400,
        -30
      ],
      "credentials": {
        "sendGridApi": "Abc SendGrid API"
      }
    }
  ],
  "connections": {
    "SendGrid Get All Contacts": {
      "main": [
        [
          {
            "node": "SendGrid Send Mail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

## Share the output returned by the last node
Both nodes do what they're supposed to, just seems only with 50 contacts (instead of currently 59).

## Information on your n8n setup
- **n8n version:** 0.127.0 
- **Database you're using (default: SQLite):** Postgres
- **Running n8n with the execution process [own(default), main]:** main
- **Running n8n via [Docker, npm, n8n.cloud, desktop app]:** Docker

Hey @somesimon,

I have just been looking at this one and looking at the SendGrid API documentation they no longer support Pagination for the Get Contacts endpoint and instead have limited it to 50 which is a bit of a pain.

We will need to have a look at the API docs to see if there is a new way to get all contacts.

1 Like

Ugh. I’ll direct this post to their support also, maybe they can help. My entire flow doesn’t work any longer :frowning:

1 Like

Hi @jon, I was in touch with their support after the info. They say we have to solve it on our side and didn’t sound that helpful.

What about getting a list and then getting all the contacts from that list?

https://docs.sendgrid.com/api-reference/contacts-api-lists/retrieve-all-recipients-on-a-list

In theory, that would solve my issues and I could email all users on that list.

Currently, you can retrieve a list, but it only allows you to retrieve a contact sample from that list.

Cheers, thanks for the support.

Hey @somesimon,

That looks like it would do the job, Because it might take a while until we can get around to making that change a temporary solution would be to use the HTTP Request node and do something like the below just update the 2 LIST_ID (one in the URL and the other in the query params) values with your list ID and change YOUR_KEY_HERE to be your API key and it should return up to 1000 results.

If that works out then we can use the same approach in the node, Would just need to work out if we toggle it or have it as an option like List > Get Members.

1 Like

Cool, I’m trying this.

I’m having trouble getting the authentication right: I have “Header auth” with “Authorization” and value “Bearer {{API key}}” but the request simply spins out.

Anyway, a thousand recipients would probably be more than good enough for a few years.

1 Like

Hey @somesimon,

Is that using header Auth in the node or use the header option I added to it? You would need to only use one of them which could be the problem. Although it may also be taking a while, try changing the 1000 to 100 and see if that is quicker.

Wow @jon - my head was just blown a little - was puzzled in your last answer why you were referring to “below” as in my Firefox you hadn’t posted anything, while I now got suspicious and checked in Chrome

Firefox

Chrome

not sure it’s an extension that causes it, anyway, back to the topic:

turns out I can call other APIs on that list, such as https://api.sendgrid.com/v3/marketing/lists/{id} without any issues with the authorization setup, but /v3/contactdb/lists/{list_id}/recipients returns an “access forbidden”.

Hey @somesimon,

That is odd I will check the api docs again. That new fancy workflow viewer sometimes needs a ctrl+F5 / cmd+shift+r to display properly.

@jon cheers Jon, appreciate the fast replies. Looks like SendGrid simply doesn’t want this to be possible. Support reports that that’s legacy and isn’t allowed.

I was under the impression you are looking for an endpoint that contains your contacts in the response section, instead of downloading them. If this is true, even though I wouldn’t like to be the bearer of bad news, I’m afraid that it’s not possible. This was only possible for our legacy marketing campaign endpoints, which is not available in your account.

I’m sorry for the confusion created in our documentation, because I know this must be frustrating. The closest we have in that endpoint is the one I mentioned, and it seems is not quite what you’re looking for.

Should you have any other concern, please let me know.

Best regards,

The endpoint they are mentioning is an endpoint that lets you download a CSV file (returns a url).

Anyway, the way I see it, I need to mirror the list somewhere else and feed the Send email node with those emails.

Now just need to find out how to query more than 15 members from the Ghost API I guess. (Ghost Admin API Documentation)

Edit: FTR on the Ghost node side getting all members is solved by adding a limit all &limit=all

Hey @somesimon,

Well that is annoying but it does save a bit of time, I will make sure we get the docs updated and have a chat internally to find out what we should do. Do we leave it at 50 or do we just remove that option :man_shrugging:

With the Ghost node I don’t think we have an option for Members yet it is just posts so we would need to get a new feature request opened for that one :slight_smile:

Ah that isn’t a problem for me at the moment, I can just query those via the Ghost API and an http request.

I guess if you make it clear, just leave it, but yeh 50 contacts indeed are nothing to write home about. Some odd behaviour by SendGrid.

1 Like

Nevermind my earlier post, this helped me fix my looping issues Loop through a JSON result set - #2 by jan

Hope this solves it for me.

Current flow if anyone ever needs a similar setup:

  • Getting the list of emails of all members on Ghost via the Ghost API (HTTP request)
  • then using the SendGrid send email node and loop through all the results
1 Like