MEMBLOG

Slack signup alerts

- 2024-12-10

We're mostly heads down building at Membrane while in Alpha*, but it's important as ever to engage with early users.

When someone signs up for Membrane, we reach out to see what they'd like to build and hear their feedback. To that end, we wrote a simple Membrane program that pings us in Slack when a new user signs up.

Premise

We use Auth0 as our auth provider. They have a feature called actions that run based on certain event triggers, like signup or login. Actions are basically webhooks.

We wrote a quick Membrane program, slack-signup-alerts, that receives signup events and sends us a message to our #user-alerts channel in Slack.

Code

This code handles requests from Auth0 and sends us a Slack message. It uses a couple Membrane-isms:

  1. nodes is how a Membrane program interfaces with its connections
  2. endpoint handles requests to a Membrane program. Each program comes with it's own HTTP endpoint
// slack-signup-alerts/index.ts

import { nodes } from "membrane";

export async function endpoint({ body }) {
  const { data } = JSON.parse(body);
  const user = data.user;

  // Filter out internal emails used to test
  if (user.email.endsWith("@membrane.io")) return;

  await nodes.slack.sendMessage({ text: `New user signup: ${user.email}` });

  return JSON.stringify({ status: 200 });
}

*We're gearing up for an open Beta soon. Book a session with us to share your feedback :)


- Pete Millspaugh (pete@membrane.io)

© 2024 Programmability, Inc.