powered by

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 orders entity that has customer_email (text) and total (decimal) fields. If you haven't created entities before, see Data modelling.
  • A Slack workspace where you can install apps, with an #orders channel.
  • Project administrator access. The Settings › Integrations page is for administrators, and connecting needs the anythink_integrations:create and anythink_integrations:update permissions.
  • 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.

  1. At api.slack.com/apps, select Create New App › From scratch, name it and choose your workspace.
  2. 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:write and channels:history.
  3. 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

  1. Go to Settings › Integrations and open the Integrations tab.
  2. On the Slack card, select Configure & Connect.
  3. Copy the callback URL from the dialog and add it under OAuth & Permissions › Redirect URLs in your Slack app.
  4. Paste the Slack app's Client ID and Client Secret, then select Save.
  5. 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.

bash
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)

text
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

  1. Go to Workflows and select New Workflow. Enter the Name notify-slack-on-order.
  2. Leave Trigger Type as Event, set Event Type to Entity Created and Entity to orders.
  3. Tick Enable Workflow and select Create Workflow. The workflow editor opens.

With the CLI

bash
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)

text
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

  1. Select Add Step in the editor's toolbar, open the Integrations tab and choose Slack.
  2. Enter the Name Notify Slack and the Key notify_slack, and tick Enable Step.
  3. Set Operation to Send Message and Credential Source to System (shared connection).
  4. Choose #orders from the Channel list of your workspace's channels, and set the message:
text
New order from {{ $anythink.trigger.data.customer_email }}: £{{ $anythink.trigger.data.total }}
  1. Save the step. Connect the Start node to it, then select Save Workflow.

With the CLI

bash
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)

text
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

  1. Open the orders entity and select Add followed by the entity's name, such as Add Order. Enter sam@example.com as customer_email and 149.50 as total, then select Create followed by the entity's name.
  2. The message "New order from sam@example.com: £149.5" appears in #orders.
  3. In the workflow, select View Job History and open the job. The notify_slack step's output shows Slack's reply: ok, channel and ts.

With the CLI

bash
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)

text
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.

Next steps