javascriptherokuslack-apibotkit

How do I use a redirect URI for an application deployed to Heroku running a worker process?


I have a worker process running on Heroku for a bot I made for Slack using Botkit and Node.js. (There is just one worker and no web processes.) When users authenticate with my app, they need to be redirected. My Heroku app is called "updooter2" which has the default domain of "https://updooter2.herokuapp.com/". In my app's settings on Slack, the redirect URI is listed as "https://updooter2.herokuapp.com/". I send a user through the OAuth flow using the link provided by Slack:

https://slack.com/oauth/authorize?client_id=xxxxxxxxx&scope=bot,reactions:write,groups:history,channels:history,channels:read

This link redirects them to "https://updooter2.herokuapp.com/" as expected. However, the webpage cannot be displayed and the authentication fails. In my app logs, I have the following:

2018-08-28T01:10:01.227047+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/?code=9428472352.424451020901.a0e68d7f7443a71bfe6e0786ee6e358c6fe7bf1932dadf70be295c8f76b8763f&state=" host=updooter2.herokuapp.com request_id=b33d5c47-9e91-4e5f-8ebe-7a6bd73027e4 fwd="169.145.120.131" dyno= connect= service= status=503 bytes= protocol=https

2018-08-28T01:10:01.650177+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=updooter2.herokuapp.com request_id=9a49db8c-5d0a-4f7f-8c95-e94562abe20f fwd="169.145.120.131" dyno= connect= service= status=503 bytes= protocol=https

How can I authenticate users of my app in this situation, ideally keeping the number of processes to just the worker? Thanks!


Solution

  • The redirect url should be something like: https://updooter2.herokuapp.com/oauth

    Take a look: https://botkit.ai/docs/provisioning/slack-events-api.html

    If you follow this guide, and then visit your app you should receive an install link that works to add the bot on your slack team. You might also want to make sure you are using the Heroku deploy link from the starter kit: https://github.com/howdyai/botkit-starter-slack#getting-started

    it should just work if you use this path.