# Update Deal — OnePageCRM

> Updates an existing deal's details in OnePageCRM. See the documentation

- Key: `onepagecrm-update-deal`
- Type: Action (Write)
- Version: 0.0.2
- App: OnePageCRM (`onepagecrm`) — https://pipedream.com/apps/onepagecrm.md
- This page (HTML): https://pipedream.com/apps/onepagecrm/actions/update-deal
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/onepagecrm/actions/update-deal/update-deal.mjs

## Description

Updates an existing deal's details in OnePageCRM. [See the documentation](https://developer.onepagecrm.com/api/)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `dealId` | `string` | Yes | The unique identifier for the deal, Options are loaded from the connected account. |
| `contactId` | `string` | No | The unique identifier for the contact Options are loaded from the connected account. |
| `ownerId` | `string` | No | ID of the user, to whom the contact belongs. Options are loaded from the connected account. |
| `pipelineId` | `string` | No | ID of a pipeline the deal belongs to. Options are loaded from the connected account. |
| `name` | `string` | No | Name of the deal. |
| `text` | `string` | No | Extra notes related to the deal (supports [b]bold[/b] and [i]italic[/i] formatting). |
| `stage` | `integer` | No | A numerical representation of the progress of a pending deal. |
| `status` | `string` | No | Status of the deal. |
| `expectedCloseDate` | `string` | No | The date the deal is expected to close. Format: YYYY-MM-DD. (status should be pending). |
| `closeDate` | `string` | No | The date the deal actually closed. (status should be won or lost)`. |
| `date` | `string` | No | Creation date of the deal. |
| `amount` | `string` | No | The monitary value of the deal (per month, if multi-month deal). |
| `months` | `integer` | No | Number of months the deal is to be paid for. (1 for regular deals, 2+ for multi-month). |
| `cost` | `string` | No | The monitary cost of the deal |
| `commissionBase` | `string` | No | Base used to calculate the commission of the deal. |
| `commissionType` | `string` | No | Type of commission for the deal. |
| `commission` | `string` | No | Commission payable for the deal. |
| `commissionPercentage` | `string` | No | Commission percentage for the deal. |

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

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: "onepagecrm-update-deal",
  arguments: {
    dealId: "Deal ID",
    contactId: "Contact ID",
  },
})
```

**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: "onepagecrm-update-deal",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    onepagecrm: { authProvisionId: "apn_xxxxxxx" },
    dealId: "Deal ID",
    contactId: "Contact ID",
  },
})

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": "onepagecrm-update-deal",
    "configured_props": {
      "onepagecrm": { "authProvisionId": "apn_xxxxxxx" },
      "dealId": "Deal ID",
      "contactId": "Contact ID"
    }
  }'
```

---

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