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);
}