Slack AI vector workflow help

Hello,
I am trying to work with the template workflow provided by Retool, which populates my vector with content from my Slack channel.

I seem to be getting this error - and I'm not quite sure what to do.....

*Error evaluating populateVectorWithSlackData: (line 3) TypeError: fetchSlackData.data.messages is not iterable
*--- Failed running query: populateVectorWithSlackData ---
*--- Hit failure ---

The problematic code is this:

const result = []

for (const entry of fetchSlackData.data.messages) {
  if (entry.subtype || !entry.thread_ts) {
    continue
  }
  
  const thread = await getThread(entry.thread_ts, startTrigger.data.channelId)
  
  const messages = thread.data.messages
  const first = messages.shift()

  const link = await getLink(first.ts, startTrigger.data.channelId)
  
  const title = link.data.permalink
  const document = [`Q: ${first.text}`, ...messages.map(m => `Reply: ${m.text}`)].join("\n")
  await addDocumentToVector(title, document)
}

return result

The three steps before this one seem to be successful. So I am authenticating ok.
Any help that you can give would be appreciated,

thanks,
Neil

Hello @maillme! Do you mind sharing what the fetchSlackData block returned?

thanks for your reply, of course:

However - I think this is incorrect, when I run this separately it is no longer authorising. It was prior to this however :frowning: - so I am not quite sure what has happened here. When I tested this previously - it said success.

Am I picking up the correct token from Slack? I'm slightly confused by which one I shoudl take, but I believe I took an app-level token: