Post to Slack when a record is created
Connect Slack to your project, then build a workflow that posts to a channel whenever a record is created. Every step in the dashboard, CLI or an AI assistant.
Last updated
You'll connect a Slack workspace to your project, then add an Integration step to a workflow that posts to #orders whenever an order is created. Each step is shown three ways: in the Anythink dashboard, with the CLI and with an AI assistant. Use whichever suits you. They all change the same project.
Before you start
You need:
- A project with an
ordersentity that hascustomer_email(text) andtotal(decimal) fields. If you haven't created entities before, see Data modelling. - A Slack workspace where you can install apps, with an
#orderschannel. - Project administrator access. The Settings › Integrations page is for administrators, and connecting needs the
anythink_integrations:createandanythink_integrations:updatepermissions. - For the AI assistant tabs, the Anythink MCP server running locally in stdio mode. The hosted MCP server doesn't run integration commands. See Connect Claude to your backend with MCP.
Step 1: Register a Slack app
This part happens in Slack, so it's the same whichever way you work.
- At api.slack.com/apps, select Create New App › From scratch, name it and choose your workspace.
- Under OAuth & Permissions, add the bot token scopes Anythink requests:
chat:write,chat:write.public,channels:read,groups:read,users:read,users:read.email,im:write,reactions:write,files:writeandchannels:history. - Keep the tab open. You'll add a redirect URL in the next step, then copy the Client ID and Client Secret from Basic Information.
Connect Slack to send workflow messages explains the scopes and covers private channels and direct messages.
Step 2: Connect Slack to your project
In the Anythink dashboard
- Go to Settings › Integrations and open the Integrations tab.
- On the Slack card, select Configure & Connect.
- Copy the callback URL from the dialog and add it under OAuth & Permissions › Redirect URLs in your Slack app.
- Paste the Slack app's Client ID and Client Secret, then select Save.
- The Anythink dashboard sends you to Slack. Approve the app for your workspace. The Slack card now shows Connected.
With the CLI
The CLI completes the OAuth flow through a listener on your machine, so add http://localhost:8745/callback to your Slack app's Redirect URLs first.
anythink integrations oauth configure slack --client-id <CLIENT_ID> --client-secret <CLIENT_SECRET>
anythink integrations oauth connect slack --name "Team workspace"
anythink integrations connections list --provider slack
oauth connect opens your browser at Slack and waits up to five minutes for you to approve the app. It then prints the new connection's ID, and connections list shows it as enabled.
With an AI assistant (MCP)
Connect Slack to this project with the anythink CLI. The OAuth client is already configured.
The assistant calls the cli tool with integrations oauth connect slack, which opens your browser for you to approve the app, and returns the connection ID.
Run oauth configure yourself in a terminal rather than through the assistant, so the Slack client secret doesn't pass through your conversation.
Step 3: Create the workflow
The workflow runs when a record is created in orders.
In the Anythink dashboard
- Go to Workflows and select New Workflow. Enter the Name
notify-slack-on-order. - Leave Trigger Type as Event, set Event Type to Entity Created and Entity to
orders. - Tick Enable Workflow and select Create Workflow. The workflow editor opens.
With the CLI
anythink workflows create notify-slack-on-order --trigger Event --event EntityCreated --entity orders --enabled
The command prints the new workflow's ID. Use it as <workflow-id> in the next steps.
With an AI assistant (MCP)
Create a workflow called notify-slack-on-order that runs when a record is created in orders. Enable it and tell me its ID.
The assistant runs workflows create through the cli tool and returns the ID.
Step 4: Add the Slack step
The step posts the message. System (shared connection) tells it to use the project connection you made in step 2.
In the Anythink dashboard
- Select Add Step in the editor's toolbar, open the Integrations tab and choose Slack.
- Enter the Name
Notify Slackand the Keynotify_slack, and tick Enable Step. - Set Operation to Send Message and Credential Source to System (shared connection).
- Choose
#ordersfrom the Channel list of your workspace's channels, and set the message:
New order from {{ $anythink.trigger.data.customer_email }}: £{{ $anythink.trigger.data.total }}
- Save the step. Connect the Start node to it, then select Save Workflow.
With the CLI
anythink workflows integration-add <workflow-id> notify_slack \
--name "Notify Slack" --provider slack --operation send-message \
--credential-source system --start --enabled \
--inputs '{"channel":"#orders","text":"New order from {{ $anythink.trigger.data.customer_email }}: £{{ $anythink.trigger.data.total }}"}'
--start makes it the workflow's first step. The {{ }} expressions are filled in for each record. See Template syntax.
With an AI assistant (MCP)
Add a Slack step to workflow <workflow-id>. Key notify_slack, operation send-message, system credential source, start step, enabled. Post to #orders: "New order from {{ $anythink.trigger.data.customer_email }}: £{{ $anythink.trigger.data.total }}".
The assistant calls the cli tool with workflows integration-add, then workflows get <workflow-id> to show the result.
How integrations work explains the other credential sources.
Step 5: Check it worked
In the Anythink dashboard
- Open the
ordersentity and select Add followed by the entity's name, such as Add Order. Entersam@example.comascustomer_emailand149.50astotal, then select Create followed by the entity's name. - The message "New order from sam@example.com: £149.5" appears in
#orders. - In the workflow, select View Job History and open the job. The
notify_slackstep's output shows Slack's reply:ok,channelandts.
With the CLI
anythink data create orders --data '{"customer_email":"sam@example.com","total":149.5}'
anythink workflows jobs <workflow-id>
anythink fetch /workflows/<workflow-id>/jobs
workflows jobs shows each job's status and, for a failed job, its error. fetch returns the full job, including each step's log and output. The output has ok, channel and ts.
With an AI assistant (MCP)
Create an order for sam@example.com with a total of 149.50, then show me the latest job for workflow <workflow-id>.
The assistant runs data create and workflows jobs through the cli tool.
If the step fails with "No credentials found for slack", the project has no enabled Slack connection. Check Settings › Integrations, or run anythink integrations connections list --provider slack and enable the connection if it's paused. See Test workflows and read job history for reading jobs and debugging failed steps.