How to merge the variable value of multiple bundles/operation into a list?

I’m trying to get the slack channels normalized names into a list from a json HTTP response. But I have tried many modules, and I only managed to get 1 channel listed.



For your aggregator, you’ll need to select the Iterator as the source module.

2 Likes

I tried that before, and I can see the names in the output, but when I add it to the Data Store module, it only gets 1 of the names.

What should I add to the Store Data field, so all the names from the output array get merged into a list?




Could you please provide a screenshot of the output bundle of the first module by right-clicking and running just that module, then clicking the bubble and copying the contents:

Screenshot_2023-08-29_100800

This will allow others to better assist you. Thanks!

2 Likes

Sure, the first module is just an HTTP Oauth2

[
    {
        "statusCode": 200,
        "headers": [
            {
                "name": "date",
                "value": "Mon, 11 Sep 2023 20:35:25 GMT"
            },
            {
                "name": "server",
                "value": "Apache"
            },
            {
                "name": "vary",
                "value": "Accept-Encoding"
            },
            {
                "name": "x-slack-req-id",
                "value": "cd42f2df75b8cf865f2c3e5758b1b862"
            },
            {
                "name": "x-content-type-options",
                "value": "nosniff"
            },
            {
                "name": "x-xss-protection",
                "value": "0"
            },
            {
                "name": "pragma",
                "value": "no-cache"
            },
            {
                "name": "cache-control",
                "value": "private, no-cache, no-store, must-revalidate"
            },
            {
                "name": "expires",
                "value": "Sat, 26 Jul 1997 05:00:00 GMT"
            },
            {
                "name": "content-type",
                "value": "application/json; charset=utf-8"
            },
            {
                "name": "x-accepted-oauth-scopes",
                "value": "channels:read,groups:read,mpim:read,im:read,read"
            },
            {
                "name": "x-oauth-scopes",
                "value": "channels:history,groups:history,im:history,mpim:history,channels:read,groups:read,im:read,mpim:read,users:read,users:read.email,users.profile:read,incoming-webhook"
            },
            {
                "name": "access-control-expose-headers",
                "value": "x-slack-req-id, retry-after"
            },
            {
                "name": "access-control-allow-headers",
                "value": "slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags"
            },
            {
                "name": "strict-transport-security",
                "value": "max-age=31536000; includeSubDomains; preload"
            },
            {
                "name": "x-slack-unique-id",
                "value": "ZP96DY0OxSuy2MduWI6ooQAAED4"
            },
            {
                "name": "x-slack-backend",
                "value": "r"
            },
            {
                "name": "referrer-policy",
                "value": "no-referrer"
            },
            {
                "name": "access-control-allow-origin",
                "value": "*"
            },
            {
                "name": "via",
                "value": "1.1 slack-prod.tinyspeck.com, envoy-www-iad-qcirmxla, envoy-edge-dub-wwmuxwmm"
            },
            {
                "name": "content-encoding",
                "value": "gzip"
            },
            {
                "name": "content-length",
                "value": "653"
            },
            {
                "name": "x-envoy-upstream-service-time",
                "value": "120"
            },
            {
                "name": "x-backend",
                "value": "main_normal main_canary_with_overflow main_control_with_overflow"
            },
            {
                "name": "x-server",
                "value": "slack-www-hhvm-main-iad-ihhz"
            },
            {
                "name": "x-slack-shared-secret-outcome",
                "value": "no-match"
            },
            {
                "name": "x-edge-backend",
                "value": "envoy-www"
            },
            {
                "name": "x-slack-edge-shared-secret-outcome",
                "value": "no-match"
            },
            {
                "name": "connection",
                "value": "close"
            }
        ],
        "cookieHeaders": [],
        "data": {
            "ok": true,
            "channels": [
                {
                    "id": "C05JZLHL031",
                    "name": "test-channel",
                    "is_channel": true,
                    "is_group": false,
                    "is_im": false,
                    "is_mpim": false,
                    "is_private": false,
                    "created": 1690719280,
                    "is_archived": false,
                    "is_general": false,
                    "unlinked": 0,
                    "name_normalized": "test-channel",
                    "is_shared": false,
                    "is_org_shared": false,
                    "is_pending_ext_shared": false,
                    "pending_shared": [],
                    "context_team_id": "T05L3TKAUQ0",
                    "updated": 1690719280619,
                    "parent_conversation": null,
                    "creator": "U05KE721WH0",
                    "is_ext_shared": false,
                    "shared_team_ids": [
                        "T05L3TKAUQ0"
                    ],
                    "pending_connected_team_ids": [],
                    "is_member": false,
                    "topic": {
                        "value": "",
                        "creator": "",
                        "last_set": 0
                    },
                    "purpose": {
                        "value": "This channel is for everything #test-channel. Hold meetings, share docs, and make decisions together with your team.",
                        "creator": "U05KE721WH0",
                        "last_set": 1690719280
                    },
                    "previous_names": [],
                    "num_members": 2
                },
                {
                    "id": "C05KE722B5Y",
                    "name": "random",
                    "is_channel": true,
                    "is_group": false,
                    "is_im": false,
                    "is_mpim": false,
                    "is_private": false,
                    "created": 1690719218,
                    "is_archived": false,
                    "is_general": false,
                    "unlinked": 0,
                    "name_normalized": "random",
                    "is_shared": false,
                    "is_org_shared": false,
                    "is_pending_ext_shared": false,
                    "pending_shared": [],
                    "context_team_id": "T05L3TKAUQ0",
                    "updated": 1690719218561,
                    "parent_conversation": null,
                    "creator": "U05KE721WH0",
                    "is_ext_shared": false,
                    "shared_team_ids": [
                        "T05L3TKAUQ0"
                    ],
                    "pending_connected_team_ids": [],
                    "is_member": false,
                    "topic": {
                        "value": "",
                        "creator": "",
                        "last_set": 0
                    },
                    "purpose": {
                        "value": "This channel is for... well, everything else. It’s a place for team jokes, spur-of-the-moment ideas, and funny GIFs. Go wild!",
                        "creator": "U05KE721WH0",
                        "last_set": 1690719218
                    },
                    "previous_names": [],
                    "num_members": 2
                },
                {
                    "id": "C05KSRL59HP",
                    "name": "general",
                    "is_channel": true,
                    "is_group": false,
                    "is_im": false,
                    "is_mpim": false,
                    "is_private": false,
                    "created": 1690719218,
                    "is_archived": false,
                    "is_general": true,
                    "unlinked": 0,
                    "name_normalized": "general",
                    "is_shared": false,
                    "is_org_shared": false,
                    "is_pending_ext_shared": false,
                    "pending_shared": [],
                    "context_team_id": "T05L3TKAUQ0",
                    "updated": 1690719218327,
                    "parent_conversation": null,
                    "creator": "U05KE721WH0",
                    "is_ext_shared": false,
                    "shared_team_ids": [
                        "T05L3TKAUQ0"
                    ],
                    "pending_connected_team_ids": [],
                    "is_member": false,
                    "topic": {
                        "value": "",
                        "creator": "",
                        "last_set": 0
                    },
                    "purpose": {
                        "value": "This is the one channel that will always include everyone. It’s a great spot for announcements and team-wide conversations.",
                        "creator": "U05KE721WH0",
                        "last_set": 1690719218
                    },
                    "previous_names": [],
                    "num_members": 2
                }
            ],
            "response_metadata": {
                "next_cursor": ""
            }
        },
        "fileSize": 2478
    }
]

Any ideas? I still can’t figure this out. Thanks

Ah, since channels is already an array (thanks for the output bundle, it really helped), you don’t even need to use an iterator or aggregator.

Just put this immediately after your trigger (HTTP) module -

a. All you need to do is use the built-in array function map(), to get the values:

Screenshot_2023-09-14_100926

b. If you want it as a comma-separated string instead, just wrap that in a join() function and add your delimiter in the second parameter:

Screenshot_2023-09-14_100939

Here’s the output of both options:

1 Like

It worked, thank you very much!