# Create Employee — TalentHR

> Hires a new employee and registers them in the system. See the documentation

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

## Description

Hires a new employee and registers them in the system. [See the documentation](https://apidocs.talenthr.io/#2950f0ba-b27b-4d4b-855f-4b79b667767c)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `firstName` | `string` | Yes | The first name of the new employee |
| `lastName` | `string` | Yes | The last name of the new employee |
| `email` | `string` | Yes | The email address of the new employee |
| `hireDate` | `string` | Yes | The date of the new employee's hire. Format YYYY-MM-DD |
| `employmentStatusId` | `string` | Yes | The employment status ID Options are loaded from the connected account. |
| `reportsToEmployeeId` | `string` | No | The ID of the employee Options are loaded from the connected account. |
| `jobTitleId` | `string` | No | The ID of the job title. Options are loaded from the connected account. |
| `jobLocationId` | `string` | No | The ID of the job location. Options are loaded from the connected account. |
| `divisionId` | `string` | No | The division for which the application has been submitted Options are loaded from the connected account. |
| `departmentId` | `string` | No | The department for which the application has been submitted Options are loaded from the connected account. |
| `payRate` | `string` | Yes | Employee's wage and must have 2 decimals. E.g 1255.38 |
| `payRatePeriod` | `string` | Yes | The period over which money is earned. |
| `payRateSchedule` | `string` | No | Frequency of the wage. |
| `overtimeStatus` | `string` | No | Determining whether an employee is exempt or non-exempt from overtime regulations. |
| `preventEmail` | `boolean` | No | Opt for 'true', if you don't want to send an invitation email to the hiring employee, else 'false'. |
| `isExisting` | `boolean` | No | Opt for 'false' if the employee is a new hire and you want to run the Automatic Onboarding process, else 'true'. |
| `whoId` | `integer` | No | The employee who will meet the newly hired employee. Required if When Time and address is present. |
| `address` | `string` | No | The address where the meeting will take place. Required if Who ID and When Time is present. |
| `whenTime` | `string` | No | The date time that the meeting will take place. Required if Who ID and address is present. The hire date must be formatted as 'YYYY-MM-DD HH:II'. |
| `instructions` | `string` | No | Important Instructions for the newly hired employee. |

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

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: "talenthr-create-employee",
  arguments: {
    firstName: "First Name",
    lastName: "Last Name",
  },
})
```

**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: "talenthr-create-employee",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    talenthr: { authProvisionId: "apn_xxxxxxx" },
    firstName: "First Name",
    lastName: "Last Name",
  },
})

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": "talenthr-create-employee",
    "configured_props": {
      "talenthr": { "authProvisionId": "apn_xxxxxxx" },
      "firstName": "First Name",
      "lastName": "Last Name"
    }
  }'
```

---

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