# Create Post — Slab

> Create a new post in Slab via the createPost GraphQL mutation, returning the full post object (e.g. {"id":"abc123","title":"Q3 Onboarding Guide","topics":[{"id":"abc12def","name":"Engineering"}]}). If Content is provided, the body is…

- Key: `slab-create-post`
- Type: Action (Write)
- Version: 0.0.1
- App: Slab (`slab`) — https://pipedream.com/apps/slab.md
- This page (HTML): https://pipedream.com/apps/slab/actions/create-post
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/slab/actions/create-post/create-post.mjs

## Description

Create a new post in Slab via the `createPost` GraphQL mutation, returning the full post object (e.g. `{"id":"abc123","title":"Q3 Onboarding Guide","topics":[{"id":"abc12def","name":"Engineering"}]}`). If **Content** is provided, the body is appended after creation via the `updatePostContent` mutation (the Slab schema does not accept content at creation time). Slab derives the displayed title from the first line of the post's content, so the appended text is inserted after the existing title line rather than replacing it — this preserves **Title** instead of overwriting it. NOTE: the returned `content` field reflects the pre-append snapshot (title line only) even though the append is applied — treat a non-error response as confirmation, not the returned `content`. New posts are published by default (set **Published** to `false` to leave it as an unpublished draft) — unpublished posts do not appear in **Search Posts**/**List Posts** results. Run **List Topics** to obtain a Topic ID to pass at creation. [See the documentation](https://studio.apollographql.com/public/Slab/variant/current/schema/reference/objects/RootMutationType#createPost).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `title` | `string` | No | Title for the new post, e.g. Q3 Engineering Onboarding Guide. |
| `content` | `string` | No | Initial body text for the post, e.g. This guide covers environment setup, team norms, and key contacts.. Inserted as literal plain text (Markdown is not rendered) after the title line via the updatePostContent mutation. |
| `topicId` | `string` | No | Optional single Topic ID to place the new post under. Run List Topics first to obtain a valid ID. The schema accepts only one topicId at creation; use Add Topic To Post to add more. |
| `templateId` | `string` | No | Optional ID of an existing Slab post to use as a template for the new post (e.g. abc123). Any post can serve as a template. Run List Posts first to obtain a valid post ID. |
| `published` | `boolean` | No | Whether the new post should be published immediately (default true). Set to false to leave it as an unpublished draft, which won't appear in Search Posts/List Posts results until published via Update Post. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "slab",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "slab-create-post",
  arguments: {
    title: "Title",
    content: "Content",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "slab-create-post",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    slab: { authProvisionId: "apn_xxxxxxx" },
    title: "Title",
    content: "Content",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "slab-create-post",
    "configured_props": {
      "slab": { "authProvisionId": "apn_xxxxxxx" },
      "title": "Title",
      "content": "Content"
    }
  }'
```

---

- App: https://pipedream.com/apps/slab.md · All apps: https://pipedream.com/apps
