# Update Deal — Teamgate

> Update a specific deal. See the docs here

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

## Description

Update a specific deal. [See the docs here](https://developers.teamgate.com/#fe590427-fcb9-4689-9671-7d3daa235b1a)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `dealId` | `integer` | Yes | The deal id which will be updated Options are loaded from the connected account. |
| `name` | `string` | Yes | Name of the Deal. E.g. "Example Ltd". |
| `buyerId` | `integer` | Yes | The person`s id Options are loaded from the connected account. |
| `pipeline` | `string` | Yes | The pipeline`s id Options are loaded from the connected account. |
| `stage` | `integer` | Yes | The stage`s Id. Options are loaded from the connected account. |
| `cartDiscountValue` | `string` | No | The discount on all cart. |
| `cartDiscountType` | `string` | No | The type of the discount. |
| `cartItems` | `string[]` | No | The object items. Example: {"id":20,"price":{"currency": "EUR","value": "10000.0000"},"discount":{"type":"percentage","value": "20.0000"},"quantity": 2} |
| `status` | `string` | No | Deal`s status |
| `priceValue` | `string` | No | The deal`s price |
| `priceCurrency` | `string` | No | The deal`s currency |
| `starred` | `boolean` | No | Indicator the deal is starred or not. |
| `ownerId` | `integer` | No | The User`s id Options are loaded from the connected account. |
| `ownerUsername` | `string` | No | The username to which the deal belongs. |
| `ownerRandom` | `string` | No | A list of users/user groups to select the random owner. Example 1: "ownerRandom": ["5", "6"], Example 2: "ownerRandom": {"groups":["1"]}, Example 3: "ownerRandom": {"0":"5","1":"6","groups":["1"]} |
| `sourceId` | `integer` | No | The source`s id Options are loaded from the connected account. |
| `source` | `string` | No | If the source does not exist it will be created. |
| `sourceDescription` | `string` | No | Will be set only if will be created new source. |
| `tags` | `string[]` | No | A list of tags |
| `estimatedClosureDate` | `string` | No | Example: 2017-03-10T11:45:59+02:00 |
| `actualClosureDate` | `string` | No | Example: 2017-03-10T11:45:59+02:00 |
| `createdDate` | `string` | No | Example: 2017-03-10T11:45:59+02:00 |
| `customFields` | `string[]` | No | A list of custom fields. Each row must be an object which the key is the custom field id. Example for string value: {"1":"Test value for field with Id 1"} |

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

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: "teamgate-update-deal",
  arguments: {
    dealId: 10,
    name: "Name",
  },
})
```

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

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": "teamgate-update-deal",
    "configured_props": {
      "teamgate": { "authProvisionId": "apn_xxxxxxx" },
      "dealId": 10,
      "name": "Name"
    }
  }'
```

---

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