# Create Visit — Referrizer

> Create a visit to an existing contact in Referrizer. See the documentation

- Key: `referrizer-create-visit`
- Type: Action (Write)
- Version: 0.0.2
- App: Referrizer (`referrizer`) — https://pipedream.com/apps/referrizer.md
- This page (HTML): https://pipedream.com/apps/referrizer/actions/create-visit
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/referrizer/actions/create-visit/create-visit.mjs

## Description

Create a visit to an existing contact in Referrizer. [See the documentation](https://api.referrizer.com/static/docs/index.html#operation/inviteContact)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `contactId` | `string` | Yes | The ID of the contact Options are loaded from the connected account. |
| `points` | `integer` | No | Loyalty points to be earned. If not provided, the number of earned points will depend on your Loyalty settings. |
| `amountSpent` | `integer` | No | Dollar amount spent connected to Earning Points value. E.g. if $1 is 1pts and when contact spent $25 they will get 25pts. This is related to loyalty settings value 'pointsPerDollar'. |
| `date` | `string` | No | Date and time of the visit in this request with the format 'YYYY-MM-DDTHH:MM:SS.SSSZ'. E.g. 2022-01-19T16:16:24.000Z. Date must be in the past. If the date is set a notification for the visit will not be sent. |

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

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: "referrizer-create-visit",
  arguments: {
    contactId: "Contact ID",
    points: 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: "referrizer-create-visit",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    referrizer: { authProvisionId: "apn_xxxxxxx" },
    contactId: "Contact ID",
    points: 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": "referrizer-create-visit",
    "configured_props": {
      "referrizer": { "authProvisionId": "apn_xxxxxxx" },
      "contactId": "Contact ID",
      "points": 10
    }
  }'
```

---

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