# Create Appointment — Microsoft Bookings

> Creates a new appointment in a Microsoft Bookings business. See the documentation

- Key: `microsoft_bookings-create-appointment`
- Type: Action (Write)
- Version: 0.0.1
- App: Microsoft Bookings (`microsoft_bookings`) — https://pipedream.com/apps/microsoft-bookings.md
- This page (HTML): https://pipedream.com/apps/microsoft-bookings/actions/create-appointment
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/microsoft_bookings/actions/create-appointment/create-appointment.mjs

## Description

Creates a new appointment in a Microsoft Bookings business. [See the documentation](https://learn.microsoft.com/en-us/graph/api/bookingbusiness-post-appointments?view=graph-rest-1.0)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `businessId` | `string` | Yes | Select a booking business Options are loaded from the connected account. |
| `serviceId` | `string` | Yes | Select a service Options are loaded from the connected account. |
| `customerId` | `string` | Yes | Select an existing customer. Important: Customers must exist in the system before booking appointments. Options are loaded from the connected account. |
| `customerName` | `string` | No | The name of the customer |
| `customerEmailAddress` | `string` | No | The SMTP address of the customer |
| `customerTimeZone` | `string` | No | The customer's time zone (e.g., America/Chicago, UTC) |
| `startDateTime` | `string` | Yes | The date and time when the appointment begins in ISO 8601 format (e.g., 2024-05-01T12:00:00) |
| `endDateTime` | `string` | Yes | The date and time when the appointment ends in ISO 8601 format (e.g., 2024-05-01T13:00:00) |
| `timeZone` | `string` | Yes | The time zone for the appointment (e.g., UTC, America/Chicago) |
| `customerPhone` | `string` | No | The phone number of the customer |
| `customerNotes` | `string` | No | Notes from the customer associated with this appointment |
| `isLocationOnline` | `boolean` | No | True indicates that the appointment will be held online |
| `staffMemberIds` | `string[]` | No | The IDs of each staff member who is scheduled in this appointment Options are loaded from the connected account. |
| `smsNotificationsEnabled` | `boolean` | No | If SMS notifications will be sent to the customers for the appointment |
| `price` | `string` | No | The regular price for the appointment |
| `priceType` | `string` | No | The pricing structure for the appointment |
| `duration` | `string` | No | The length of the appointment in ISO 8601 format (e.g., PT1H for 1 hour, PT30M for 30 minutes). If not specified, calculated from start/end times. |
| `maximumAttendeesCount` | `integer` | No | The maximum number of customers allowed in this appointment |
| `preBuffer` | `string` | No | Time to reserve before the appointment in ISO 8601 format (e.g., PT15M for 15 minutes) |
| `postBuffer` | `string` | No | Time to reserve after the appointment in ISO 8601 format (e.g., PT15M for 15 minutes) |
| `serviceNotes` | `string` | No | Notes from the staff member about this appointment |
| `additionalInformation` | `string` | No | Additional information sent to the customer when the appointment is confirmed |
| `isCustomerAllowedToManageBooking` | `boolean` | No | Indicates that the customer can manage bookings created by the staff |
| `optOutOfCustomerEmail` | `boolean` | No | If true, the customer doesn't wish to receive a confirmation for this appointment |

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

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: "microsoft_bookings-create-appointment",
  arguments: {
    businessId: "Business",
    serviceId: "Service",
  },
})
```

**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: "microsoft_bookings-create-appointment",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    microsoft_bookings: { authProvisionId: "apn_xxxxxxx" },
    businessId: "Business",
    serviceId: "Service",
  },
})

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": "microsoft_bookings-create-appointment",
    "configured_props": {
      "microsoft_bookings": { "authProvisionId": "apn_xxxxxxx" },
      "businessId": "Business",
      "serviceId": "Service"
    }
  }'
```

---

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