I am building Slack App using Bolt SDK. Based on tutorial I have create a app.js:
const { App } = require('@slack/bolt');
const jsforce = require('jsforce');
// Initializes your app with your bot token and signing secret
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
port: process.env.PORT || 3000
});
(async () => {
// Start your app
await app.start();
console.log('⚡️ Bolt app is running!');
})();
app.shortcut('who_am_i', async ({
shortcut,
ack,
client
}) => {
try {
const connection = new jsforce.Connection({
loginUrl: process.env.SF_LOGIN_URL
});
const userInfo = await connection.login(
process.env.SF_USERNAME,
process.env.SF_PASSWORD
);
// Acknowledge shortcut request
await ack();
// Call the views.open method using one of the built-in WebClients
const result = await client.views.open({
trigger_id: shortcut.trigger_id,
view: {
type: 'modal',
title: {
type: 'plain_text',
text: 'My App'
},
close: {
type: 'plain_text',
text: 'Close'
},
blocks: [{
type: 'section',
text: {
type: 'mrkdwn',
text: `Slack ID, ${shortcut.user.id} SF User ID ${userInfo.id}`
}
}]
}
});
console.log(result);
} catch (error) {
console.error(error);
}
});
Now I try to trigger a Salesforce Flow using shortcut, but cannot find any related documentation regarding this.
Is it possible to trigger a flow (named 'TestFlow') using Bolt SDK? If yes, how I can do it? Is there documentation?
App logic: Slack user will run a shortcut, will get modal where he/she will input number and after clicking "Submit" button user will trigger a flow.
I can add view for inputting the number, but I cannot find anything related to the flow triggering.