# Add Activity — Pipedrive

> Adds a new activity. Includes more_activities_scheduled_in_context property in response's additional_data which indicates whether there are more undone activities scheduled with the same deal, person or organization (depending on the…

- Key: `pipedrive-add-activity`
- Type: Action (Write)
- Version: 0.1.26
- App: Pipedrive (`pipedrive`) — https://pipedream.com/apps/pipedrive.md
- This page (HTML): https://pipedream.com/apps/pipedrive/actions/add-activity
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/pipedrive/actions/add-activity/add-activity.mjs

## Description

Adds a new activity. Includes `more_activities_scheduled_in_context` property in response's `additional_data` which indicates whether there are more undone activities scheduled with the same deal, person or organization (depending on the supplied data). See the Pipedrive API docs for Activities [here](https://developers.pipedrive.com/docs/api/v1/#!/Activities). For info on [adding an activity in Pipedrive](https://developers.pipedrive.com/docs/api/v1/Activities#addActivity)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `subject` | `string` | Yes | Subject of the activity |
| `type` | `string` | Yes | Type of the activity. This is in correlation with the key_string parameter of ActivityTypes. Options are loaded from the connected account. |
| `ownerId` | `integer` | No | ID of the user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user. Options are loaded from the connected account. |
| `dealId` | `string` | No | ID of the deal this activity will be associated with Options are loaded from the connected account. |
| `leadId` | `string` | No | ID of the lead this activity will be associated with Options are loaded from the connected account. |
| `orgId` | `integer` | No | ID of the organization this activity will be associated with Options are loaded from the connected account. |
| `projectId` | `string` | No | ID of the project this activity will be associated with Options are loaded from the connected account. |
| `dueDate` | `string` | No | Due date of the activity. Format: YYYY-MM-DD |
| `dueTime` | `string` | No | Due time of the activity in UTC. Format: HH:MM |
| `duration` | `string` | No | Duration of the activity. Format: HH:MM |
| `busy` | `boolean` | No | Set the activity as 'Busy' or 'Free'. If the flag is set to true, your customers will not be able to book that time slot through any Scheduler links |
| `done` | `boolean` | No | Whether the activity is done or not. |
| `location` | `object` | No | The address of the activity. Pipedrive will automatically check if the location matches a geo-location on Google maps. |
| `participants` | `string[]` | No | List of multiple persons (participants) this activity will be associated with. If omitted, single participant from person_id field is used. It requires a structure as follows: [{"person_id":1,"primary":true}] Options are loaded from the connected account. |
| `attendees` | `string[]` | No | Attendees of the activity. This can be either your existing Pipedrive contacts or an external email address. It requires a structure as follows: [{"email":"mail@example.org"}] Options are loaded from the connected account. |
| `publicDescription` | `string` | No | Additional details about the activity that will be synced to your external calendar. Unlike the note added to the activity, the description will be publicly visible to any guests added to the activity. |
| `note` | `string` | No | Note of the activity (HTML format) |

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

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: "pipedrive-add-activity",
  arguments: {
    subject: "Subject",
    type: "Type",
  },
})
```

**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: "pipedrive-add-activity",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pipedrive: { authProvisionId: "apn_xxxxxxx" },
    subject: "Subject",
    type: "Type",
  },
})

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": "pipedrive-add-activity",
    "configured_props": {
      "pipedrive": { "authProvisionId": "apn_xxxxxxx" },
      "subject": "Subject",
      "type": "Type"
    }
  }'
```

---

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