> ## Documentation Index
> Fetch the complete documentation index at: https://docs.humaniq.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Customer Service Recipes

> Approval workflows for customer support and service operations

<Note>
  These recipes provide approval workflows for common customer service scenarios, designed to balance quick response times with appropriate oversight.
</Note>

<Tabs>
  <Tab title="Complaint Escalation">
    ### Complaint Escalation

    Manage complaint escalations with intelligent routing based on severity and customer tier.

    <CodeGroup>
      ```typescript Basic theme={null}
      const escalateComplaint = needsHumanApproval({
        type: 'async',
        title: 'Complaint Escalation',
        ask: (args) => `Review escalation request for ticket #${args.ticketId}`,
        autoApprove: async (args) => args.customerTier === 'VIP'
      })
      ```

      ```typescript Advanced theme={null}
      const escalateComplaint = needsHumanApproval({
        type: 'async',
        title: 'Complaint Escalation',
        ask: (args) => {
          const priority = args.severity === 'HIGH' ? '🔔 URGENT: ' : '';
          const vip = args.customerTier === 'VIP' ? '[VIP] ' : '';
          return `${priority}${vip}Review escalation for ticket #${args.ticketId}`;
        },
        approvers: (args) => {
          if (args.severity === 'HIGH' || args.customerTier === 'VIP') {
            return [{ name: 'Senior Support', email: 'senior-support@company.com' }];
          }
          return [{ name: 'Support Lead', email: 'support-lead@company.com' }];
        },
        approvalArguments: {
          ticketSummary: {
            type: 'longString',
            value: args.summary,
            label: 'Ticket Summary',
            editable: false
          },
          severity: {
            type: 'string',
            value: args.severity,
            label: 'Severity Level',
            editable: true
          }
        }
      })
      ```
    </CodeGroup>

    <AccordionGroup>
      <Accordion title="When to use this" icon="lightbulb">
        * Customer dissatisfaction escalations
        * VIP customer issues
        * Complex technical problems
        * Multi-department issues
      </Accordion>

      <Accordion title="Best practices" icon="check">
        * Include full ticket history
        * Set clear severity criteria
        * Define compensation limits
        * Document resolution attempts
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="Account Modifications">
    ### Account Modifications

    Handle sensitive account changes with appropriate verification.

    <CodeGroup>
      ```typescript Basic theme={null}
      const modifyAccount = needsHumanApproval({
        type: 'sync',
        title: 'Account Modification',
        ask: (args) => `Approve changes to account ${args.accountId}?`
      })
      ```

      ```typescript Advanced theme={null}
      const modifyAccount = needsHumanApproval({
        type: 'sync',
        title: 'Account Modification',
        ask: (args) => {
          const sensitive = args.changes.billing ? '⚠️ SENSITIVE: ' : '';
          return `${sensitive}Review changes to account ${args.accountId}`;
        },
        approvalArguments: {
          currentState: {
            type: 'longString',
            value: JSON.stringify(args.currentState, null, 2),
            label: 'Current Settings',
            editable: false
          },
          proposedChanges: {
            type: 'longString',
            value: JSON.stringify(args.changes, null, 2),
            label: 'Proposed Changes',
            editable: true
          }
        }
      })
      ```
    </CodeGroup>

    <AccordionGroup>
      <Accordion title="When to use this" icon="lightbulb">
        * Billing changes
        * Permission updates
        * Profile modifications
        * Security settings
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="Service Credits">
    ### Service Credits

    Manage service credit approvals and compensation.

    ```typescript theme={null}
    const issueServiceCredit = needsHumanApproval({
      type: 'sync',
      title: 'Service Credit',
      ask: (args) => `Approve service credit of $${args.amount} for account ${args.accountId}?`,
      approvalArguments: {
        amount: {
          type: 'number',
          value: args.amount,
          label: 'Credit Amount',
          editable: true
        },
        reason: {
          type: 'string',
          value: args.reason,
          label: 'Credit Reason',
          editable: true
        }
      },
      // Auto-approve SLA violations within limit
      autoApprove: async (args) => {
        return args.isSlaViolation && args.amount <= 250;
      }
    })
    ```

    <AccordionGroup>
      <Accordion title="Best practices" icon="check">
        * Set clear approval thresholds
        * Document SLA violations
        * Track compensation history
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="Bulk Updates">
    ### Bulk Customer Updates

    Handle mass customer account updates safely.

    ```typescript theme={null}
    const bulkCustomerUpdate = needsHumanApproval({
      type: 'sync',
      title: 'Bulk Customer Update',
      ask: (args) => {
        const count = args.affectedAccounts.length;
        return `Review bulk update affecting ${count} customer accounts`;
      },
      approvalArguments: {
        updateType: {
          type: 'string',
          value: args.updateType,
          label: 'Update Type',
          editable: false
        },
        affectedAccounts: {
          type: 'longString',
          value: args.affectedAccounts.join('\n'),
          label: 'Affected Accounts',
          editable: true
        }
      }
    })
    ```
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="Support Integration" icon="headset" href="/recipes/legal">
    Explore legal approval workflows
  </Card>

  <Card title="Financial Recipes" icon="money-bill" href="/recipes/financial">
    Explore financial approval workflows
  </Card>
</CardGroup>
