2024年11月20日

GPT 操作库 - Workday

,

目录

  1. 通用应用信息
  2. 从ChatGPT到Workday的身份验证
  3. 示例用例:休假申请与福利计划查询
  4. 其他资源
  5. 结论

通用应用信息

Workday是一个基于云的平台,提供人力资本管理、薪资和财务管理的解决方案。通过自定义操作将ChatGPT与Workday集成,可以通过自动回复员工查询、指导员工完成HR流程以及从Workday检索关键信息来增强人力资源运营。

ChatGPT的Workday自定义操作功能让企业能够利用AI优化人力资源流程、自动化任务并提供个性化的员工支持。这包括虚拟HR助手,可用于解答福利、休假和薪资相关的查询。

从ChatGPT到Workday的身份验证

要将ChatGPT与Workday连接,请使用OAuth:

  • 需要Workday管理员权限才能获取客户端ID和客户端密钥。
  • Important URLs:
    • 授权URL: [Workday Tenant URL]/authorize, 通常格式为: https://wd5-impl.workday.com//authorize
    • 令牌URL: [Workday Tenant URL]/token, 通常格式为: https://wd5-impl-services1.workday.com/ccx/oauth2//token

请参考在Workday中创建API客户端后提供的URL。Workday将根据租户和数据中心提供所需的特定URL。

设置OAuth的步骤:

  1. 在Workday中使用Register API客户端任务。
  2. 在工作日中设置您的API客户端设置,类似于下面提供的示例。
  3. 权限范围将根据GPT执行的操作而有所不同。对于此用例,您将需要:Staffing, Tenant Non-Configurable, Time Off and Leave, Include Workday Owned Scope
  4. 将GPT中的重定向URI输入到API客户端设置中。
  5. 存储客户端ID客户端密钥以便后续在GPT中使用。
  6. 将OAuth详情添加到GPT认证部分,如下所示。

一旦在GPT设置界面选择OAuth作为认证方式,重定向URI将从GPT设置中获取。

workday-cgpt-oauth.png

workday-api-client.png

Workday社区关于API客户端的页面是深入学习的优质资源(需要社区账号)

示例用例:提交休假申请与福利计划查询

概述

该用例展示了如何帮助员工通过RAAS报告提交休假申请、获取员工详细信息以及查看福利计划。

GPT 使用说明

使用以下指令覆盖PTO提交用例、员工详细信息检索和福利计划查询:

# **Context:** You support employees by providing detailed information about their PTO submissions, worker details, and benefit plans through the Workday system. You help them submit PTO requests, retrieve personal and job-related information, and view their benefit plans. Assume the employees are familiar with basic HR terminologies.
# **Instructions:**
## Scenarios
### - When the user asks to submit a PTO request, follow this 3 step process:
1. Ask the user for PTO details, including start date, end date, and type of leave.
2. Submit the request using the `Request_Time_Off` API call.
3. Provide a summary of the submitted PTO request, including any information on approvals.

### - When the user asks to retrieve worker details, follow this 2 step process:
1. Retrieve the worker’s details using `Get_Workers`.
2. Summarize the employee’s job title, department, and contact details for easy reference.

### - When the user asks to inquire about benefit plans, follow this 2 step process:
1. Retrieve benefit plan details using `Get_Report_As_A_Service`.
2. Present a summary of the benefits.

代表员工创建请求

由于在Workday中对员工执行操作需要员工ID,因此在执行任何查询之前都需要获取此信息。我们通过在认证后调用Workday中的RAAS报告来实现这一点,该报告会提供登录用户的信息。可能还有一种方法仅通过REST API调用本身就能实现。一旦返回ID,它将在所有其他操作中使用。

示例RAAS报告:使用Current User字段将返回通过OAuth认证的工作人员。
custom-report-workday-01.png

custom-report-workday-02.png

OpenAPI 规范

以下是使用Workday REST API参考和ActionsGPT生成的OpenAPI模式示例。

我们正在使用以下API调用:

  • [POST] Request_Time_Off: 为员工创建一个休假申请。
  • [GET] Get_Workers: 获取工作者详细信息。
  • [GET] Get_eligibleAbsenceTypes: 获取符合条件的休假计划。
  • [GET] Get_Report_As_A_Service (RAAS): 获取报告,包括自定义RAAS报告,用于福利详情。

将路径替换为正确的租户ID,并将其配置到适当的服务器上。确保为不同的PTO类型正确设置所需的ID。

openapi: 3.1.0
info:
  title: Workday Employee API
  description: API to manage worker details, absence types, and benefit plans in Workday.
  version: 1.3.0
servers:
  - url: https://wd5-impl-services1.workday.com/ccx
    description: Workday Absence Management API Server
paths:
  /service/customreport2/tenant/GPT_RAAS:
    get:
      operationId: getAuthenticatedUserIdRaaS
      summary: Retrieve the Employee ID for the authenticated user.
      description: Fetches the Employee ID for the authenticated user from Workday.
      responses:
        '200':
          description: A JSON object containing the authenticated user's Employee ID.
          content:
            application/json:
              schema:
                type: object
                properties:
                  employeeId:
                    type: string
                    description: The Employee ID of the authenticated user.
                    example: "5050"
        '401':
          description: Unauthorized - Invalid or missing Bearer token.
      security:
        - bearerAuth: []
 
  /api/absenceManagement/v1/tenant/workers/Employee_ID={employeeId}/eligibleAbsenceTypes:
    get:
      operationId: getEligibleAbsenceTypes
      summary: Retrieve eligible absence types by Employee ID.
      description: Fetches a list of eligible absence types for a worker by their Employee ID, with a fixed category filter.
      parameters:
        - name: employeeId
          in: path
          required: true
          description: The Employee ID of the worker (passed as `Employee_ID=3050` in the URL).
          schema:
            type: string
            example: "5050"
        - name: category
          in: query
          required: true
          description: Fixed category filter for the request. This cannot be changed.
          schema:
            type: string
            example: "17bd6531c90c100016d4b06f2b8a07ce"
      responses:
        '200':
          description: A JSON array of eligible absence types.
          content:
            application/json:
              schema:
                type: object
                properties:
                  absenceTypes:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
        '401':
          description: Unauthorized - Invalid or missing Bearer token.
        '404':
          description: Worker or absence types not found.
      security:
        - bearerAuth: []
 
  /api/absenceManagement/v1/tenant/workers/Employee_ID={employeeId}:
    get:
      operationId: getWorkerById
      summary: Retrieve worker details by Employee ID.
      description: Fetches detailed information of a worker using their Employee ID.
      parameters:
        - name: employeeId
          in: path
          required: true
          description: The Employee ID of the worker.
          schema:
            type: string
            example: "5050"
      responses:
        '200':
          description: A JSON object containing worker details.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: object
                    properties:
                      firstName:
                        type: string
                      lastName:
                        type: string
                  position:
                    type: string
                  email:
                    type: string
        '401':
          description: Unauthorized - Invalid or missing Bearer token.
        '404':
          description: Worker not found.
      security:
        - bearerAuth: []
 
  /api/absenceManagement/v1/tenant/workers/Employee_ID={employeeId}/requestTimeOff:
    post:
      operationId: requestTimeOff
      summary: Request time off for a worker.
      description: Allows a worker to request time off by providing the necessary details.
      parameters:
        - name: employeeId
          in: path
          required: true
          description: The Employee ID of the worker requesting time off.
          schema:
            type: string
            example: "5050"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                days:
                  type: array
                  description: Array of days for which the time off is being requested.
                  items:
                    type: object
                    properties:
                      start:
                        type: string
                        format: date
                        description: The start date of the time off.
                        example: "2024-11-26"
                      date:
                        type: string
                        format: date
                        description: The specific date for the time off.
                        example: "2024-11-26"
                      end:
                        type: string
                        format: date
                        description: The end date of the time off.
                        example: "2024-11-26"
                      dailyQuantity:
                        type: number
                        description: The number of hours per day to take off.
                        example: 8
                      timeOffType:
                        type: object
                        description: Time off type with corresponding ID.
                        properties:
                          id:
                            type: string
                            description: The ID of the time off type.
                            example: "b35340ce4321102030f8b5a848bc0000"
                            enum:
                              - <flexible_time_off_id_from_workday>  # Flexible Time Off ID (hexa format)
                              - <sick_leave_id_from_workday>  # Sick Leave ID (hexa format)
      responses:
        '200':
          description: Time off request created successfully.
        '400':
          description: Invalid input or missing parameters.
        '401':
          description: Unauthorized - Invalid or missing Bearer token.
        '404':
          description: Worker not found.
      security:
        - bearerAuth: []
 
  /service/customreport2/tenant/GPT_Worker_Benefit_Data:
    get:
      operationId: getWorkerBenefitPlans
      summary: Retrieve worker benefit plans enrolled by Employee ID.
      description: Fetches the benefit plans in which the worker is enrolled using their Employee ID.
      parameters:
        - name: Worker!Employee_ID
          in: query
          required: true
          description: The Employee ID of the worker.
          schema:
            type: string
            example: "5020"
        - name: format
          in: query
          required: true
          description: The format of the response (e.g., `json`).
          schema:
            type: string
            example: "json"
      responses:
        '200':
          description: A JSON array of the worker's enrolled benefit plans.
          content:
            application/json:
              schema:
                type: object
                properties:
                  benefitPlans:
                    type: array
                    items:
                      type: object
                      properties:
                        planName:
                          type: string
                        coverage:
                          type: string
                        startDate:
                          type: string
                          format: date
                        endDate:
                          type: string
                          format: date
        '401':
          description: Unauthorized - Invalid or missing Bearer token.
        '404':
          description: Worker or benefit plans not found.
      security:
        - bearerAuth: []
 
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    worker:
      type: object
      properties:
        id:
          type: string
        name:
          type: object
          properties:
            firstName:
              type: string
            lastName:
              type: string
        position:
          type: string
        email:
          type: string
    absenceTypes:
      type: array
      items:
        type: object
        properties:
          id:
            type: string
          name:
            type: string
    benefitPlans:
      type: array
      items:
        type: object
        properties:
          planName:
            type: string
          coverage:
            type: string
          startDate:
            type: string
            format: date
          endDate:
            type: string
            format: date
    timeOffTypes:
      type: object
      description: Mapping of human-readable time off types to their corresponding IDs.
      properties:
        Flexible Time Off:
          type: string
          example: "b35340ce4321102030f8b5a848bc0000"
        Sick Leave:
          type: string
          example: "21bd0afbfbf21011e6ccc4dc170e0000"
 
 

结论

恭喜您成功设置了一个用于Workday的GPT,具备提交休假申请、查询员工详情和福利计划等功能!

该集成可以简化人力资源流程,快速访问个人信息,并让员工轻松申请带薪休假。本指南提供了一个可定制的框架,用于在Workday中实现ChatGPT,使您能够轻松添加更多操作并进一步增强GPT功能。

workday-gpt.png

pto-request.png