-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Conversation
…m to any custom host
Can you help me understand what use case you have in mind for this? Slackbot.js relies on the default slack API, not sure when an average user would ever want to change that. What are you building? 😄 |
average user maybe no, but why not to have ability to change it when you need it? as I mentioned in previous PR my team needs it for testing |
@@ -338,7 +338,8 @@ function Slackbot(configuration) { | |||
slack_botkit.getAuthorizeURL = function(team_id, redirect_params) { | |||
|
|||
var scopes = slack_botkit.config.scopes; | |||
var url = 'https://slack.com/oauth/authorize' + '?client_id=' + | |||
var api_host = process.env.api_host ? process.env.api_host : 'slack.com'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could be more readable process.env.api_host || 'slack.com';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it's more concise, but I think it's less readable, because the result is pretty unpredictable for js newbies. In many languages this statement will proceed boolean true, which will be converted to something like 1, "true", etc.
@@ -13,8 +13,9 @@ function noop() {} | |||
* @returns {Object} A callback-based Slack API interface. | |||
*/ | |||
module.exports = function(bot, config) { | |||
var api_host = process.env.api_host ? process.env.api_host : 'slack.com'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as I mentioned above
We are building a service for deploying bots to different platforms. E.g. we have a Slack bot and want it to work on Skype. Link to the service: https://message.io/ |
If you are wanting to change the URL for testing, have a look at https://github.com/Skellington-Closet/slack-mock That will intercept your requests without needing to change the URL. |
No it's not for testing. It will be used on production for switching bots from real slack api to the proxy, which I described before. |
@afilatov1989 It would probably be better to add message.io support as a intergration akin to how we implented twilio or facebook versus hacking slack specific .js files. This way you preserve slack functionality, and users can start with a message.io starter kit we can host in the project if that is how they want to start building their bot. |
This is included in 0.5! |
Allows users to change default "slack.com" api host to any custom host via env variable.
Can be useful for various api proxies needed by different services.