# Create Event — Agiliron

> Creates a new event within Agiliron. See the documentation

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

## Description

Creates a new event within Agiliron. [See the documentation](https://api.agiliron.com/docs/add-event-2)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `subject` | `string` | Yes | The subject of the event |
| `startdate` | `string` | Yes | The start date of the event (format: MM-DD-YYYY) |
| `starttime` | `string` | Yes | The start time of the event (format: HH:MM) |
| `durationInHours` | `string` | No | The duration of the event in hours |
| `durationInMinutes` | `string` | No | The duration of the event in minutes |
| `recurringEvents` | `string` | No | Details of the recurring events |
| `repeatUntil` | `string` | No | The end date of the recurring events (format: MM-DD-YYYY) |
| `accountName` | `string` | No | The name of the account related to the event |
| `contactName` | `string` | No | The name of the contact related to the event Options are loaded from the connected account. |
| `sendReminder` | `string` | No | Whether to send a reminder for the event |
| `reminderDays` | `string` | No | Number of days before the event to send a reminder |
| `reminderHours` | `string` | No | Number of hours before the event to send a reminder |
| `reminderMinutes` | `string` | No | Number of minutes before the event to send a reminder |
| `status` | `string` | No | The status of the event |
| `sendNotification` | `string` | No | Whether to send a notification for the event |
| `activityType` | `string` | No | The type of activity for the event |
| `location` | `string` | No | The location of the event |
| `description` | `string` | No | The description of the event |
| `customFields` | `object` | No | An object of custom fields for the lead. Format: {customFieldName01: "Value 01"} |
| `relatedToType` | `string` | No | The type of the entity related to the event |

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

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: "agiliron-create-event",
  arguments: {
    subject: "Subject",
    startdate: "Start Date",
  },
})
```

**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: "agiliron-create-event",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    agiliron: { authProvisionId: "apn_xxxxxxx" },
    subject: "Subject",
    startdate: "Start Date",
  },
})

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": "agiliron-create-event",
    "configured_props": {
      "agiliron": { "authProvisionId": "apn_xxxxxxx" },
      "subject": "Subject",
      "startdate": "Start Date"
    }
  }'
```

---

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