# Update Opportunity — Keap (Infusionsoft)

> Update an existing opportunity in Keap CRM. See the documentation

- Key: `infusionsoft-update-opportunity`
- Type: Action (Write)
- Version: 0.0.1
- App: Keap (Infusionsoft) (`infusionsoft`) — https://pipedream.com/apps/infusionsoft.md
- This page (HTML): https://pipedream.com/apps/infusionsoft/actions/update-opportunity
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/infusionsoft/actions/update-opportunity/update-opportunity.ts

## Description

Update an existing opportunity in Keap CRM. [See the documentation](https://developer.infusionsoft.com/docs/rest/#tag/Opportunity/operation/updatePropertiesOnOpportunity)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `opportunityId` | `string` | Yes | Select an Opportunity from the list. Alternatively, you can provide a custom Opportunity ID. Options are loaded from the connected account. |
| `opportunityTitle` | `string` | No | The title of the opportunity |
| `contactId` | `integer` | No | Select a Contact from the list. Alternatively, you can provide a custom Contact ID. Options are loaded from the connected account. |
| `stageId` | `string` | No | Select an Opportunity Stage from the list. Alternatively, you can provide a custom Stage ID. Options are loaded from the connected account. |
| `userId` | `string` | No | Select a User from the list. Alternatively, you can provide a custom User ID. Options are loaded from the connected account. |
| `projectedRevenueHigh` | `string` | No | The high estimate of projected revenue |
| `projectedRevenueLow` | `string` | No | The low estimate of projected revenue |
| `estimatedCloseTime` | `string` | No | The estimated close date/time in ISO 8601 format |
| `nextActionTime` | `string` | No | The date/time for the next action in ISO 8601 format |
| `nextActionNotes` | `string` | No | Notes about the next action to take |
| `opportunityNotes` | `string` | No | General notes about the opportunity |
| `includeInForecast` | `boolean` | No | Whether to include this opportunity in revenue forecasts |
| `customFields` | `string` | No | JSON array of custom field objects with id and content. Example: [{"id": "1", "content": "value"}] |

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

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: "infusionsoft-update-opportunity",
  arguments: {
    opportunityId: "Opportunity",
    opportunityTitle: "Opportunity Title",
  },
})
```

**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: "infusionsoft-update-opportunity",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    infusionsoft: { authProvisionId: "apn_xxxxxxx" },
    opportunityId: "Opportunity",
    opportunityTitle: "Opportunity Title",
  },
})

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": "infusionsoft-update-opportunity",
    "configured_props": {
      "infusionsoft": { "authProvisionId": "apn_xxxxxxx" },
      "opportunityId": "Opportunity",
      "opportunityTitle": "Opportunity Title"
    }
  }'
```

---

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