To use Events API for Slack App development, there is a setting for “Events API Request URLs” as described in doc:
In the Events API, your Events API Request URL is the target location
where all the events your application is subscribed to will be
delivered, regardless of the team or event type.
There is a UI for changing the URL “manually” at api.slack.com
under
“Event Subscriptions” section in settings. There is also url_verification
event after changing the Request URL described here.
My question – Is there an API call (method) so I can update the endpoint (Request URL) from my server code?
For example, in Facebook API there is a call named subscriptions
where I can change webhook URL after initial setup – link
Making a POST request with the callback_url, verify_token, and object
fields will reactivate the subscription.
PS. To give a background, this is needed for development using outbound tunnel with dynamic endpoint URL, e.g. ngrok free subscription. By the way, ngrok is referenced in sample “onboarding” app by slack here
Update. I checked Microsoft Bot Framework, and they seems to use RTM (Real Time Messaging) for slack which doesn’t require Request URL setup, and not Events API. Same time, e.g. for Facebook they (MS Bot) instruct me to manually put their generated URL to webhook settings of a FB app, so there is no automation on that.
2
Answers
No, such a method does not exist in the official documentation. There might be an unofficial method – there are quite a few of them actually – but personally I doubt it.
But you don’t need this feature for developing Slack apps. Just simulate the POST calls from Slack on your local dev machine with a script and then do a final test together with Slack on your webserver on the Internet.
Since this question was originally asked, Slack has introduced app manifests, which enable API calls to change app configurations. This can be used to update URLs and other parameters, or create/delete apps.
At the time of writing, the manifest / manifest API is in beta:
so the this answer might not exactly fit the latest syntax as they make changes.
A programatic workflow might look as follows:
API List
Basic API list
JSON
:apps.manifest.export
JSON
:apps.manifest.validate
apps.manifest.update
apps.manifest.create
apps.manifest.delete
Most of these API requests are Tier 1 requests, so only on the order of 1+ per minute.
API Access
You’ll need to create and maintain "App Configuration Tokens". They’re created in the "Your Apps" dashboard. More info about them here.
Example
NodeJS
CodeHope this helps anyone else looking to update Slack applications programatically.