Tutorial: post new sign-ups to Slack
Know the moment someone joins your app. You will connect Slack, add one workflow that posts each new member to a channel and also notifies your admins in the app, and test it without waiting for a real sign-up. It builds on the todo tutorial, but works on any app with a sign-up persona.
1. Connect Slack
- Open the project, then Backend, Integrations.
- Find Slack, click Connect and approve it in your Slack workspace.
- Copy the id of the channel to post to (in Slack: channel details, at the bottom), for example
C0123456789.
2. Add the workflow
Ask your agent:
When a new member signs up, post "New sign-up: <name> (<email>)" to Slack
channel C0123456789, and notify admins in the app.It adds this workflow (send it with patch_contract as a set_workflow op, or put it in workflows):
{
"id": "slack-new-member",
"title": "Post new sign-ups to Slack",
"on": {
"entity": "member",
"event": "created"
},
"do": [
{
"action": "integration",
"integration": "slack",
"call": "send_channel_message",
"props": {
"channel": "C0123456789",
"text": "New sign-up: {{name}} ({{email}})"
}
},
{
"action": "notify",
"role": "admin",
"title": "New sign-up",
"body": "{{name}} just joined"
}
]
}The todo app has no admin role, so add one first: a staff persona and its table.
"personas": [
{ "id": "member", "label": "Member", "description": "keeps a personal todo list", "kind": "consumer" },
{ "id": "admin", "label": "Admin", "description": "runs the app", "kind": "staff" }
],
"entities": [
{ "name": "admin", "label_field": "name", "fields": [{ "name": "name", "type": "text" }] },
…
]On check, Appbricx adds a Team page for the admin so they can invite other admins. Apply.
3. Test without a real sign-up
Create a member row as the platform would on sign-up, through the app's data API so the workflow fires:
edit_rows { "table": "member", "env": "dev", "op": "insert",
"rows": [{ "name": "Test Person", "email": "test@example.com" }] }Or in the builder: Backend, Data, table member, add a row. Then check:
- Slack shows "New sign-up: Test Person (test@example.com)".
- The admin sees a "New sign-up" notification.
- Backend, Logs (or
logs) shows the run ofslack-new-memberand what Slack answered.
4. Publish
Deploy. From now on every real sign-up on production posts to the channel.
Gotchas
- Before you connect Slack, the Slack step is skipped and the notify step still runs. The run log says so.
- Use the channel id, not its name. Invite the Slack app to private channels.
- SQL inserts don't fire workflows. Test with
edit_rowsor the Data pane, which go through the app's data API. - Don't post private data to a busy channel. Name and email may already be more than you want there.