Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@slack/interactive-messages

Package Overview
Dependencies
Maintainers
11
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slack/interactive-messages - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

30

dist/adapter.js

@@ -239,7 +239,15 @@ 'use strict';

var action = payload.actions && payload.actions[0];
// The following result value represents "no replacement"
var result = { status: 200 };
// when the matcher finds a dialog submission, it will populate this value with a function
var dialogPromiseResolve = void 0;
var respond = function respond(message) {
debug('sending async response');
return _this4.axios.post(payload.response_url, message);
if (payload.response_url) {
debug('sending async response');
return _this4.axios.post(payload.response_url, message);
} else if (dialogPromiseResolve) {
dialogPromiseResolve(message);
}
return true;
};

@@ -282,2 +290,18 @@

// Dialog submissions must be responded to in under 3 seconds
// Setting timeout to 2.5 seconds to account for propagation
if (payload.type === 'dialog_submission') {
var ms = 2500;
if (callbackResult) {
result = { status: 200, content: (0, _util.promiseTimeout)(ms, callbackResult) };
} else {
result = {
status: 200, content: new Promise(function (resolve) {
dialogPromiseResolve = resolve;
})
};
}
return true;
}
if (callbackResult) {

@@ -305,3 +329,3 @@ // Checking for Promise type

exports.default = SlackMessageAdapter;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9hZGFwdGVyLmpzIl0sIm5hbWVzIjpbImRlYnVnIiwiZm9ybWF0TWF0Y2hpbmdDb25zdHJhaW50cyIsIm1hdGNoaW5nQ29uc3RyYWludHMiLCJyZXQiLCJjYWxsYmFja0lkIiwiT2JqZWN0IiwiYXNzaWduIiwidmFsaWRhdGVDb25zdHJhaW50cyIsIlR5cGVFcnJvciIsInZhbGlkYXRlQWN0aW9uQ29uc3RyYWludHMiLCJhY3Rpb25Db25zdHJhaW50cyIsInR5cGUiLCJTbGFja01lc3NhZ2VBZGFwdGVyIiwidmV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AgICAgaWYgKGNvbnN0cmFpbnRzLmNhbGxiYWNrSWQpIHtcbiAgICAgICAgaWYgKGlzU3RyaW5nKGNvbnN0cmFpbnRzLmNhbGxiYWNrSWQpICYmIHBheWxvYWQuY2FsbGJhY2tfaWQgIT09IGNvbnN0cmFpbnRzLmNhbGxiYWNrSWQpIHtcbiAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGlzUmVnRXhwKGNvbnN0cmFpbnRzLmNhbGxiYWNrSWQpICYmICFjb25zdHJhaW50cy5jYWxsYmFja0lkLnRlc3QocGF5bG9hZC5jYWxsYmFja19pZCkpIHtcbiAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaWYgKGFjdGlvbiAmJiBjb25zdHJhaW50cy50eXBlICYmIGNvbnN0cmFpbnRzLnR5cGUgIT09IGFjdGlvbi50eXBlKSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgIH1cblxuICAgICAgaWYgKCd1bmZ1cmwnIGluIGNvbnN0cmFpbnRzICYmXG4gICAgICAgICAgIChcbiAgICAgICAgICAgICAoY29uc3RyYWludHMudW5mdXJsICYmICFwYXlsb2FkLmlzX2FwcF91bmZ1cmwpIHx8XG4gICAgICAgICAgICAgKCFjb25zdHJhaW50cy51bmZ1cmwgJiYgcGF5bG9hZC5pc19hcHBfdW5mdXJsKVxuICAgICAgICAgICApXG4gICAgICAgICApIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfVxuXG4gICAgICB0cnkge1xuICAgICAgICBjYWxsYmFja1Jlc3VsdCA9IGZuLmNhbGwodGhpcywgcGF5bG9hZCwgcmVzcG9uZCk7XG4gICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICBkZWJ1ZygnY2FsbGJhY2sgZXJyb3I6ICVvJywgZXJyb3IpO1xuICAgICAgICByZXN1bHQgPSB7IHN0YXR1czogNTAwIH07XG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgfVxuXG4gICAgICBpZiAoY2FsbGJhY2tSZXN1bHQpIHtcbiAgICAgICAgLy8gQ2hlY2tpbmcgZm9yIFByb21pc2UgdHlwZVxuICAgICAgICBpZiAodHlwZW9mIGNhbGxiYWNrUmVzdWx0LnRoZW4gPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICBjYWxsYmFja1Jlc3VsdC50aGVuKHJlc3BvbmQpLmNhdGNoKChlcnJvcikgPT4ge1xuICAgICAgICAgICAgZGVidWcoJ2FzeW5jIGVycm9yIGZvciBjYWxsYmFjay4gY2FsbGJhY2tfaWQ6ICVzLCBlcnJvcjogJXMnLFxuICAgICAgICAgICAgICAgICAgcGF5bG9hZC5jYWxsYmFja19pZCwgZXJyb3IubWVzc2FnZSk7XG4gICAgICAgICAgfSk7XG4gICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cbiAgICAgICAgcmVzdWx0ID0geyBzdGF0dXM6IDIwMCwgY29udGVudDogY2FsbGJhY2tSZXN1bHQgfTtcbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICB9XG4gICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9KTtcblxuICAgIHJldHVybiByZXN1bHQ7XG4gIH1cbn1cbiJdfQ==
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9hZGFwdGVyLmpzIl0sIm5hbWVzIjpbImRlYnVnIiwiZm9ybWF0TWF0Y2hpbmdDb25zdHJhaW50cyIsIm1hdGNoaW5nQ29uc3RyYWludHMiLCJyZXQiLCJjYWxsYmFja0lkIiwiT2JqZWN0IiwiYXNzaWduIiwidmFsaWRhdGVDb25zdHJhaW50cyIsIlR5cGVFcnJvciIsInZhbGlkYXRlQWN0aW9uQ29uc3RyYWludHMiLCJhY3Rpb25Db25zdHJhaW50cyIsInR5cGUiLCJTbGFja01lc3NhZ2VBZGF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rUmVzdWx0O1xuXG4gICAgICBpZiAoY29uc3RyYWludHMuY2FsbGJhY2tJZCkge1xuICAgICAgICBpZiAoaXNTdHJpbmcoY29uc3RyYWludHMuY2FsbGJhY2tJZCkgJiYgcGF5bG9hZC5jYWxsYmFja19pZCAhPT0gY29uc3RyYWludHMuY2FsbGJhY2tJZCkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoaXNSZWdFeHAoY29uc3RyYWludHMuY2FsbGJhY2tJZCkgJiYgIWNvbnN0cmFpbnRzLmNhbGxiYWNrSWQudGVzdChwYXlsb2FkLmNhbGxiYWNrX2lkKSkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBpZiAoYWN0aW9uICYmIGNvbnN0cmFpbnRzLnR5cGUgJiYgY29uc3RyYWludHMudHlwZSAhPT0gYWN0aW9uLnR5cGUpIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfVxuXG4gICAgICBpZiAoJ3VuZnVybCcgaW4gY29uc3RyYWludHMgJiZcbiAgICAgICAgICAgKFxuICAgICAgICAgICAgIChjb25zdHJhaW50cy51bmZ1cmwgJiYgIXBheWxvYWQuaXNfYXBwX3VuZnVybCkgfHxcbiAgICAgICAgICAgICAoIWNvbnN0cmFpbnRzLnVuZnVybCAmJiBwYXlsb2FkLmlzX2FwcF91bmZ1cmwpXG4gICAgICAgICAgIClcbiAgICAgICAgICkge1xuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICB9XG5cbiAgICAgIHRyeSB7XG4gICAgICAgIGNhbGxiYWNrUmVzdWx0ID0gZm4uY2FsbCh0aGlzLCBwYXlsb2FkLCByZXNwb25kKTtcbiAgICAgIH0gY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgIGRlYnVnKCdjYWxsYmFjayBlcnJvcjogJW8nLCBlcnJvcik7XG4gICAgICAgIHJlc3VsdCA9IHsgc3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gICAgICAgICAgIHBheWxvYWQuY2FsbGJhY2tfaWQsIGVycm9yLm1lc3NhZ2UpO1xuICAgICAgICAgIH0pO1xuICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICB9XG4gICAgICAgIHJlc3VsdCA9IHsgc3RhdHVzOiAyMDAsIGNvbnRlbnQ6IGNhbGxiYWNrUmVzdWx0IH07XG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgfVxuICAgICAgcmV0dXJuIHRydWU7XG4gICAgfSk7XG5cbiAgICByZXR1cm4gcmVzdWx0O1xuICB9XG59XG4iXX0=
//# sourceMappingURL=adapter.js.map

36

dist/express-middleware.js

@@ -29,24 +29,26 @@ 'use strict';

function sendResponse(res) {
return function _sendResponse(_ref) {
var status = _ref.status,
content = _ref.content;
return function _sendResponse(dispatchResult) {
var status = dispatchResult.status,
content = dispatchResult.content;
debug('sending response - status: %s, content: %o', status, content);
return new Promise(function (resolve, reject) {
var contentReady = content && typeof content.then === 'function' ? content : Promise.resolve(content);
return contentReady.then(function (c) {
res.status(status);
res.set('X-Slack-Powered-By', poweredBy);
if (content) {
res.json(content);
if (c) {
res.json(c);
} else {
res.end();
}
res.on('finish', function () {
// res._headers is an undocumented property, but we feel comfortable using it because:
// 1. express depends on it and express is so foundational in node
// 2. this is logging code and the risk of this causing a break is minimal
// eslint-disable-next-line no-underscore-dangle
debug('response finished - status: %d, headers: %o', res.statusCode, res._headers);
resolve(res);
return new Promise(function (resolve, reject) {
res.on('finish', function () {
// res._headers is an undocumented property, but we feel comfortable using it because:
// 1. express depends on it and express is so foundational in node
// 2. this is logging code and the risk of this causing a break is minimal
// eslint-disable-next-line no-underscore-dangle
debug('response finished - status: %d, headers: %o', res.statusCode, res._headers);
resolve(res);
});
res.on('error', reject);
});
res.on('error', reject);
});

@@ -57,3 +59,3 @@ };

return function slackMessageAdapterMiddleware(req, res, next) {
debug('request recieved - method: %s, path: %s', req.method, req.path);
debug('request received - method: %s, path: %s', req.method, req.path);

@@ -92,3 +94,3 @@ // Bind a response function to this request's respond object. This may be used in a number of

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9leHByZXNzLW1pZGRsZXdhcmUuanMiXSwibmFtZXMiOlsiY3JlYXRlRXhwcmVzc01pZGRsZXdhcmUiLCJlcnJvckNvZGVzIiwiTk9fQk9EWV9QQVJTRVIiLCJUT0tFTl9WRVJJRklDQVRJT05fRkFJTFVSRSIsImRlYnVnIiwiYWRhcHRlciIsInBvd2VyZWRCeSIsInNlbmRSZXNwb25zZSIsInJlcyIsIl9zZW5kUmVzcG9uc2UiLCJzdGF0dXMiLCJjb250ZW50IiwiUHJvbWlzZSIsInJlc29sdmUiLCJyZWplY3QiLCJzZXQiLCJqc29uIiwiZW5kIiwib24iLCJzdGF0dXNDb2RlIiwiX2hlYWRlcnMiLCJzbGFja01lc3NhZ2VBZGFwdGVyTWlkZGxld2FyZSIsInJlcSIsIm5leHQiLCJtZXRob2QiLCJwYXRoIiwicmVzcG9uZCIsImJvZHkiLCJlcnJvciIsIkVycm9yIiwiY29kZSIsInNzbF9jaGVjayIsInBheWxvYWQiLCJKU09OIiwicGFyc2UiLCJ0b2tlbiIsInZlcmlmaWNhdGlvblRva2VuIiwiZGlzcGF0Y2giLCJjYXRjaCJdLCJtYXBwaW5ncyI6Ijs7Ozs7O1FBVWdCQSx1QixHQUFBQSx1Qjs7QUFWaEI7Ozs7QUFDQTs7OztBQUVPLElBQU1DLGtDQUFhO0FBQ3hCQyxrQkFBZ0IsdUNBRFE7QUFFeEJDLDhCQUE0QjtBQUZKLENBQW5COztBQUtQLElBQU1DLFFBQVEscUJBQWEsZ0RBQWIsQ0FBZDs7QUFFTyxTQUFTSix1QkFBVCxDQUFpQ0ssT0FBakMsRUFBMEM7QUFDL0MsTUFBTUMsWUFBWSw4QkFBbEI7O0FBRUE7QUFDQSxXQUFTQyxZQUFULENBQXNCQyxHQUF0QixFQUEyQ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ICAgIGNvbnN0IGVycm9yID0gbmV3IEVycm9yKCdTbGFjayBpbnRlcmFjdGl2ZSBtZXNzYWdlIHZlcmlmaWNhdGlvbiBmYWlsZWQnKTtcbiAgICAgIGVycm9yLmNvZGUgPSBlcnJvckNvZGVzLlRPS0VOX1ZFUklGSUNBVElPTl9GQUlMVVJFO1xuICAgICAgbmV4dChlcnJvcik7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGRlYnVnKCdyZXF1ZXN0IHRva2VuIHZlcmlmaWNhdGlvbiBzdWNjZXNzJyk7XG5cbiAgICByZXNwb25kKGFkYXB0ZXIuZGlzcGF0Y2gocGF5bG9hZCkpXG4gICAgICAuY2F0Y2gobmV4dCk7XG4gIH07XG59XG4iXX0=
//# sourceMappingURL=express-middleware.js.map

@@ -6,2 +6,3 @@ 'use strict';

});
exports.promiseTimeout = promiseTimeout;
exports.packageIdentifier = packageIdentifier;

@@ -23,2 +24,14 @@

function promiseTimeout(ms, promise) {
// Create a promise that rejects in <ms> milliseconds
var timeout = new Promise(function (resolve, reject) {
var id = setTimeout(function () {
clearTimeout(id);
reject('Promise timed out');
}, ms);
});
// Returns a race between our timeout and the passed in promise
return Promise.race([promise, timeout]);
}
// NOTE: before this can be an external module:

@@ -43,3 +56,3 @@ // 1. are all the JS features supported back to a reasonable version?

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy91dGlsLmpzIl0sIm5hbWVzIjpbInBhY2thZ2VJZGVudGlmaWVyIiwiZXNjYXBlIiwicyIsInJlcGxhY2UiLCJhZGRvbnMiLCJpZGVudGlmaWVyTWFwIiwiT2JqZWN0IiwiYXNzaWduIiwibmFtZSIsInZlcnNpb24iLCJwbGF0Zm9ybSIsInJlbGVhc2UiLCJub2RlIiwicHJvY2VzcyIsImtleXMiLCJyZWR1Y2UiLCJhY2MiLCJrIl0sIm1hcHBpbmdzIjoiOzs7OztRQVlnQkEsaUIsR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5wbGF0Zm9ybSgpfWBdOiBvcy5yZWxlYXNlKCksXG4gICAgbm9kZTogcHJvY2Vzcy52ZXJzaW9uLnJlcGxhY2UoJ3YnLCAnJyksXG4gIH0sIGFkZG9ucyk7XG4gIHJldHVybiBPYmplY3Qua2V5cyhpZGVudGlmaWVyTWFwKS5yZWR1Y2UoKGFjYywgaykgPT4gYCR7YWNjfSAke2VzY2FwZShrKX0vJHtlc2NhcGUoaWRlbnRpZmllck1hcFtrXSl9YCwgJycpO1xufVxuIl19
//# sourceMappingURL=util.js.map
{
"name": "@slack/interactive-messages",
"version": "0.1.2",
"version": "0.2.0",
"description": "Slack Interactive Messages module",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -30,3 +30,3 @@ # Interactive Message Adapter for Node and Express

Select the **Interactive Messages** feature, and enable it. Input your **Request URL**. If your app
will use dynamic menus, you also need to input a **Options URL**.
will use dynamic message menus, you also need to input a **Options URL**.

@@ -240,2 +240,7 @@ ![Configuring a request URL](support/interactive-messages.gif)

### Dialogs
This adapter can be used in conjunction with Slack dialogs. Because any dialog submission request requires a synchronous response, a response is needed within 3 seconds. If your asynchronous code cannot return within sufficient time, the adapter will fallback to responding with a `200 OK` successful response to avoid any user-facing errors.
### Error handling

@@ -242,0 +247,0 @@

@@ -9,3 +9,3 @@ import http from 'http';

import { createExpressMiddleware } from './express-middleware';
import { packageIdentifier } from './util';
import { packageIdentifier, promiseTimeout } from './util';

@@ -178,7 +178,15 @@ const debug = debugFactory('@slack/interactive-messages:adapter');

const action = payload.actions && payload.actions[0];
// The following result value represents "no replacement"
let result = { status: 200 };
// when the matcher finds a dialog submission, it will populate this value with a function
let dialogPromiseResolve;
const respond = (message) => {
debug('sending async response');
return this.axios.post(payload.response_url, message);
if (payload.response_url) {
debug('sending async response');
return this.axios.post(payload.response_url, message);
} else if (dialogPromiseResolve) {
dialogPromiseResolve(message);
}
return true;
};

@@ -222,2 +230,16 @@

// Dialog submissions must be responded to in under 3 seconds
// Setting timeout to 2.5 seconds to account for propagation
if (payload.type === 'dialog_submission') {
const ms = 2500;
if (callbackResult) {
result = { status: 200, content: promiseTimeout(ms, callbackResult) };
} else {
result = {
status: 200, content: new Promise((resolve) => { dialogPromiseResolve = resolve; }),
};
}
return true;
}
if (callbackResult) {

@@ -224,0 +246,0 @@ // Checking for Promise type

@@ -16,21 +16,24 @@ import debugFactory from 'debug';

function sendResponse(res) {
return function _sendResponse({ status, content }) {
debug('sending response - status: %s, content: %o', status, content);
return new Promise((resolve, reject) => {
return function _sendResponse(dispatchResult) {
const { status, content } = dispatchResult;
const contentReady = (content && typeof content.then === 'function') ? content : Promise.resolve(content);
return contentReady.then((c) => {
res.status(status);
res.set('X-Slack-Powered-By', poweredBy);
if (content) {
res.json(content);
if (c) {
res.json(c);
} else {
res.end();
}
res.on('finish', () => {
// res._headers is an undocumented property, but we feel comfortable using it because:
// 1. express depends on it and express is so foundational in node
// 2. this is logging code and the risk of this causing a break is minimal
// eslint-disable-next-line no-underscore-dangle
debug('response finished - status: %d, headers: %o', res.statusCode, res._headers);
resolve(res);
return new Promise((resolve, reject) => {
res.on('finish', () => {
// res._headers is an undocumented property, but we feel comfortable using it because:
// 1. express depends on it and express is so foundational in node
// 2. this is logging code and the risk of this causing a break is minimal
// eslint-disable-next-line no-underscore-dangle
debug('response finished - status: %d, headers: %o', res.statusCode, res._headers);
resolve(res);
});
res.on('error', reject);
});
res.on('error', reject);
});

@@ -41,3 +44,3 @@ };

return function slackMessageAdapterMiddleware(req, res, next) {
debug('request recieved - method: %s, path: %s', req.method, req.path);
debug('request received - method: %s, path: %s', req.method, req.path);

@@ -44,0 +47,0 @@ // Bind a response function to this request's respond object. This may be used in a number of

@@ -6,2 +6,17 @@ import os from 'os';

export function promiseTimeout(ms, promise) {
// Create a promise that rejects in <ms> milliseconds
const timeout = new Promise((resolve, reject) => {
const id = setTimeout(() => {
clearTimeout(id);
reject('Promise timed out');
}, ms);
});
// Returns a race between our timeout and the passed in promise
return Promise.race([
promise,
timeout,
]);
}
// NOTE: before this can be an external module:

@@ -8,0 +23,0 @@ // 1. are all the JS features supported back to a reasonable version?

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc