# Add Deal — Salesmate

> This API is used to add a deal. See docs here

- Key: `salesmate-add-deal`
- Type: Action (Write)
- Version: 0.0.2
- App: Salesmate (`salesmate`) — https://pipedream.com/apps/salesmate.md
- This page (HTML): https://pipedream.com/apps/salesmate/actions/add-deal
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/salesmate/actions/add-deal/add-deal.ts

## Description

This API is used to add a deal. [See docs here](https://apidocs.salesmate.io/#fc738a12-8757-46aa-8625-3379fa205377)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `title` | `string` | Yes | Title for the deal. |
| `primaryContact` | `integer` | Yes | Primary contact for the deal. User can select it from pre-defined contacts or add a quick contact. Options are loaded from the connected account. |
| `owner` | `integer` | Yes | Owner of the deal. Options are loaded from the connected account. |
| `pipeline` | `string` | Yes | Select a pipeline from pre-defined pipelines. Options are loaded from the connected account. |
| `status` | `string` | Yes | The deal's status like Open, Won or Lost. By default it is Open. Options are loaded from the connected account. |
| `stage` | `string` | Yes | The stage for a deal. like new, contacted, qualified, proposal presented or in negotiation. Options are loaded from the connected account. |
| `primaryCompany` | `integer` | No | Primary Company for the deal. User can select it from pre-defined companies or add a quick company. Options are loaded from the connected account. |
| `source` | `string` | No | The source from where the contact came to know about the user's company or deal's information like ads, internet etc. Options are loaded from the connected account. |
| `estimatedCloseDate` | `string` | No | User can select estimated close date for the deal. |
| `dealValue` | `string` | No | This field contains value of the deal. |
| `currency` | `string` | No | The three-letter ISO currency code, in uppercase. Options are loaded from the connected account. |
| `priority` | `string` | No | Set the priority for the deal like high, low or medium. Options are loaded from the connected account. |
| `dealDescription` | `string` | No | This field contains details related to the deal. It has an arbitrary string attached to the deal object. |
| `tags` | `string[]` | No | This field contains tags associated with a deal. Options are loaded from the connected account. |
| `contactFollowers` | `string[]` | No | Array of the followers of particular deal. Every follower has some more attributes like isOwner if the follower is owner or not. follower's id, name, email address, type, photo, image path and can view the deal status. Options are loaded from the connected account. |
| `userFollowers` | `string[]` | No | Array of the followers of particular deal. Every follower has some more attributes like isOwner if the follower is owner or not. follower's id, name, email address, type, photo, image path and can view the deal status. Options are loaded from the connected account. |

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

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: "salesmate-add-deal",
  arguments: {
    title: "Title",
    primaryContact: 10,
  },
})
```

**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: "salesmate-add-deal",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    salesmate: { authProvisionId: "apn_xxxxxxx" },
    title: "Title",
    primaryContact: 10,
  },
})

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": "salesmate-add-deal",
    "configured_props": {
      "salesmate": { "authProvisionId": "apn_xxxxxxx" },
      "title": "Title",
      "primaryContact": 10
    }
  }'
```

---

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