Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Add support for modals
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansydnor committed Oct 8, 2019
1 parent c07785d commit d8acdd2
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion lib/Slack_web_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ module.exports = function(bot, config) {
'users.lookupByEmail',
'users.setPhoto',
'users.profile.get',
'users.profile.set'
'users.profile.set',
'views.open',
'views.update',
'views.push'
];

/**
Expand Down Expand Up @@ -224,6 +227,21 @@ module.exports = function(bot, config) {
slack_api.callAPI('chat.update', options, cb);
};

slack_api.views.open = function(options, cb) {
sanitizeOptions(options);
slack_api.callAPI('views.open', options, cb);
};

slack_api.views.update = function(options, cb) {
sanitizeOptions(options);
slack_api.callAPI('views.update', options, cb);
};

slack_api.views.push = function(options, cb) {
sanitizeOptions(options);
slack_api.callAPI('views.push', options, cb);
};

// specify that files get uploaded using multipart
slack_api.files.upload = function(options, cb) {
slack_api.callAPI('files.upload', options, cb, !!options.file);
Expand All @@ -246,6 +264,14 @@ module.exports = function(bot, config) {
bot.log.error('Could not parse blocks', err);
}
}
if (options.view && typeof(options.view) != 'string') {
try {
options.view = JSON.stringify(options.view);
} catch (err) {
delete options.view;
bot.log.error('Could not parse view', err);
}
}
}


Expand Down

0 comments on commit d8acdd2

Please sign in to comment.