Convert MongoDB + Express Slack app to Stitch app?

I would like to know if it’s possible to create an interactive Slack app using MongoDB Stitch. I can show texts and buttons on Slack by slash commands on Stitch. What I cannot figure out is how to add functions to these buttons. For example, I would like to create a form on modal when a user clicks the button, and save user input data to MongoDB Atlas upon submitting the form.

My current Slack app is running on localhost:3000 that is responsible for interactions with users. The app communicates with MongoDB Atlas through Express server that is running on localhost:5000.

My impression is that I can substitute 5000 and a part of 3000 (slash commands) by Stitch. Is it possible to have full functionalities of 3000 (authentication, creation of modals, reaction to user action etc.) with Stitch?

Hi @Ayumi_Nakamura,
First of all welcome to the forum.

My impression is that I can substitute 5000 and a part of 3000 (slash commands) by Stitch.

Without knowing more on what these services do, I would say depends on what they’re doing.

Having said that, you can try to create Stitch Incoming HTTP Webhook to receive Slack slash commands. The Slack commands would send sent some data in the payload that you could process. You can use some of the fields for authentication.

MongoDB Stitch provides several authentication providers, in your case you would probably be interested in Custom Function Authentication. This authentication provider allows you to use a Stitch function to implement your own user authentication logic. i.e. based on user_id, team_id, enterprise_id or channel_id sent by Slack slash command(s).

For Slack creation of modals (based on my limited knowledge of Slack apps), the Stitch Webhook(s) just need to be able to compose an initial view mixes it with a trigger_id to create a modal. See also Slack: An Overview of Modals.

If you have more questions regarding Slack app development, I would recommend to post on Slack: Support and Community discussions to reach a wider audience with Slack expertise. If you have more questions on how to create web-hook(s) in MongoDB Stitch please include more information on what you’re trying to do, and any relevant error messages.


1 Like

Thank you @wan!

Slash commands with Stitch incoming HTTP webhook work fine. Just to confirm that I understood your explanation correctly, do I need to create additional webhooks for custom authentication and event subscriptions? 1 for slash commands, 1 for authentication and 1 for listening to slack events?

In my local app, URL for slash commands and event subscriptions are the same, and authentication has another. Do I need to separate webhooks for slash commands and event subscriptions in Stitch app?

If it’s possible, probably preferable to separate them. As I imagined the event subscriptions itself is already containing a few logics (i.e. handling open, update, push, etc).