# Send Conversion Event — LinkedIn Ads

> Sends a conversion event to LinkedIn Ads. See the documentation

- Key: `linkedin_ads-send-conversion-event`
- Type: Action (Write)
- Version: 0.0.8
- App: LinkedIn Ads (`linkedin_ads`) — https://pipedream.com/apps/linkedin-ads.md
- This page (HTML): https://pipedream.com/apps/linkedin-ads/actions/send-conversion-event
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/linkedin_ads/actions/send-conversion-event/send-conversion-event.mjs

## Description

Sends a conversion event to LinkedIn Ads. [See the documentation](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads-reporting/conversions-api?view=li-lms-2024-01&tabs=http#streaming-conversion-events)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `adAccountId` | `string` | Yes | Sponsored ad account id to match results by Options are loaded from the connected account. |
| `conversionId` | `string` | Yes | The ID of the conversion event. Options are loaded from the connected account. |
| `conversionHappenedAt` | `string` | Yes | Epoch timestamp in milliseconds at which the conversion event happened. Note: If your source records conversion timestamp in seconds, please insert 000 at the end to transform it to milliseconds. Eg. 1590739275000. |
| `email` | `string` | Yes | Email address of the contact associated with the conversion event which needs to be in SHA256 format, a HEX encoded string with a maximum length of 64 characters. Eg. test@example.com. |
| `firstName` | `string` | Yes | The first name of the contact to match the conversion. |
| `lastName` | `string` | Yes | The last name of the contact to match the conversion. |
| `conversionValueCurrencyCode` | `string` | Yes | The currency code of the conversion value in ISO format. Eg. USD. |
| `conversionValueAmount` | `string` | Yes | The value of the conversion in decimal string. If you set this field, you must also set in the Conversion Value Currency Code field. Eg. 100.05. |
| `companyName` | `string` | No | A plain text string representing the company of the contact to match. |
| `title` | `string` | No | A plain text string representing the title name of the contact to match. Eg. Software Engineer. |
| `countryCode` | `string` | No | An ISO standardized two letter country code representing the country of the contact to match. Eg. US. |
| `eventId` | `string` | No | The unique id generated by advertisers to indicate each event. This field is used for deduplication. |

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

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: "linkedin_ads-send-conversion-event",
  arguments: {
    adAccountId: "Ad Account Id",
    conversionId: "Conversion 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: "linkedin_ads-send-conversion-event",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    linkedin_ads: { authProvisionId: "apn_xxxxxxx" },
    adAccountId: "Ad Account Id",
    conversionId: "Conversion 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": "linkedin_ads-send-conversion-event",
    "configured_props": {
      "linkedin_ads": { "authProvisionId": "apn_xxxxxxx" },
      "adAccountId": "Ad Account Id",
      "conversionId": "Conversion ID"
    }
  }'
```

---

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