Slack module is not whitelisted

I’m trying to use the @slack/web-api module in my cloud code and I’m getting the following error:

[Event from Cloud App] [7e03fcb7] [710a8080a132bbe41ef32a17c17ad319]  
failed due to compilation error  
VMError: The module '@slack/web-api' is not whitelisted in VM.

Here’s the code:

const { WebClient } = require('@slack/web-api');
const token = "xoxp-22900...";
const web = new WebClient(token);
const conversationId = 'C....';

module.exports = async function (event) {
  const res = await web.chat.postMessage({ channel: conversationId, text: 'Hello there' });
  print('Message sent: ' + res.ts);
}

Hi! Thanks for pointing that out! Today we added @slack/web-api to the whitelisted dependencies in the Cloud Code VM. It seems that the package we whitelisted previously has been marked as legacy by Slack and has been split into smaller modules.

2 Likes

Thanks, Slack integration is now working.