# Create Event — Heartbeat

> Create a new Event in a Heartbeat community. See the documentation

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

## Description

Create a new Event in a Heartbeat community. [See the documentation](https://heartbeat.readme.io/reference/createevent)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | Yes | The name of the event |
| `description` | `string` | No | The description of the event |
| `startTime` | `string` | Yes | The start date & time of the event. Accepts datetimes in the following formats: YYYY-MM-DD hh:mm:ss e.g. 2023-11-28 10:00:00, YYYY-MM-DD hh:mm e.g. 2023-11-28 10:00, YYYY-MM-DD e.g. 2023-11-28 |
| `duration` | `integer` | Yes | The duration of the event in minutes |
| `location` | `string` | Yes | Where the event will be held. If the string 'HEARTBEAT' is provided, then the event will take place in a Heartbeat voice channel. If the string 'ZOOM' is provided, then the event will take place in a custom Zoom link (this option can only be chosen if a Zoom account has been integrated with Heartbeat). Otherwise, the provided string will be passed directly to the Custom location field |
| `invitedUsers` | `string[]` | No | A list of users that should be invited to the event. If the email matches an existing Heartbeat user, the Heartbeat user will be invited. Otherwise, an event invite will be sent directly to the provided email address. If both Invited Users & Invited Groups are empty, the event will be open to everyone in the community Options are loaded from the connected account. |
| `invitedGroups` | `string[]` | No | A list of groups that should be invited to the event. If both Invited Users and Invited Groups are empty, the event will be open to everyone in the community Options are loaded from the connected account. |

## 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": "heartbeat",
      },
    },
  },
)

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: "heartbeat-create-event",
  arguments: {
    name: "Name",
    description: "Description",
  },
})
```

**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: "heartbeat-create-event",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    heartbeat: { authProvisionId: "apn_xxxxxxx" },
    name: "Name",
    description: "Description",
  },
})

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": "heartbeat-create-event",
    "configured_props": {
      "heartbeat": { "authProvisionId": "apn_xxxxxxx" },
      "name": "Name",
      "description": "Description"
    }
  }'
```

---

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