# Create Custom Activity — Ortto

> Creates a unique activity for a person. Can optionally initialize a new record beforehand. See the documentation

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

## Description

Creates a unique activity for a person. Can optionally initialize a new record beforehand. [See the documentation](https://help.ortto.com/a-271-create-a-custom-activity-event-create)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `activityId` | `string` | Yes | The Id of the activity definition. To find Activity ID, login into your Ortto app > CDP > Activities > Select an activity, then you can find the Activity ID in the browser URL as https://ortto.app/{Org}/activities/{Activity_ID}/overview. For example, if your Activity URL is https://ortto.app/pipedreamtest/activities/act::s/overview, then your Activity ID is act::s |
| `attributes` | `object` | Yes | An object with the attributes. To find Activity attributes, login into your Ortto app > CDP > Activities > Select an activity > Developer. |
| `fields` | `object` | Yes | The object containing the fields for a person associated with 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": "ortto",
      },
    },
  },
)

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: "ortto-create-custom-activity",
  arguments: {
    activityId: "Activity Id",
    attributes: "Attributes",
  },
})
```

**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: "ortto-create-custom-activity",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    ortto: { authProvisionId: "apn_xxxxxxx" },
    activityId: "Activity Id",
    attributes: "Attributes",
  },
})

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": "ortto-create-custom-activity",
    "configured_props": {
      "ortto": { "authProvisionId": "apn_xxxxxxx" },
      "activityId": "Activity Id",
      "attributes": "Attributes"
    }
  }'
```

---

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