scripts: setup Freescout custom fields
This commit is contained in:
7
.env
7
.env
@@ -18,4 +18,9 @@ SSL_EMAIL=patrick.haas@eks-intec.de
|
|||||||
POSTGRES_PASSWORD=change_me_securely
|
POSTGRES_PASSWORD=change_me_securely
|
||||||
|
|
||||||
# Milvus Configuration
|
# Milvus Configuration
|
||||||
MILVUS_API_URL=http://milvus:19530
|
MILVUS_API_URL=http://milvus:19530
|
||||||
|
|
||||||
|
# Freescout API Configuration
|
||||||
|
FREESCOUT_API_KEY=your_api_key_here
|
||||||
|
FREESCOUT_API_BASE=https://ekshelpdesk.fft-it.de/api/v1
|
||||||
|
FREESCOUT_MAILBOX_ID=1
|
||||||
84
scripts/setup-freescout-fields.sh
Normal file
84
scripts/setup-freescout-fields.sh
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Freescout Custom Fields Setup Script
|
||||||
|
# Creates 3 custom fields via Freescout API:
|
||||||
|
# 1. AI_SUGGESTION (Text Field)
|
||||||
|
# 2. AI_SUGGESTION_STATUS (Dropdown)
|
||||||
|
# 3. PROCESSED_BY_AI (Checkbox)
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Environment variables validation
|
||||||
|
if [ -z "$FREESCOUT_API_BASE" ]; then
|
||||||
|
echo "❌ Error: FREESCOUT_API_BASE environment variable not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$FREESCOUT_API_KEY" ]; then
|
||||||
|
echo "❌ Error: FREESCOUT_API_KEY environment variable not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$FREESCOUT_MAILBOX_ID" ]; then
|
||||||
|
echo "❌ Error: FREESCOUT_MAILBOX_ID environment variable not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting Freescout custom fields setup..."
|
||||||
|
echo "API Base: $FREESCOUT_API_BASE"
|
||||||
|
echo "Mailbox ID: $FREESCOUT_MAILBOX_ID"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Function to create custom field
|
||||||
|
create_field() {
|
||||||
|
local name=$1
|
||||||
|
local title=$2
|
||||||
|
local type=$3
|
||||||
|
local required=$4
|
||||||
|
local options=$5
|
||||||
|
|
||||||
|
echo "Creating field: $name ($title)..."
|
||||||
|
|
||||||
|
if [ -z "$options" ]; then
|
||||||
|
# For text and checkbox fields without options
|
||||||
|
curl -X POST "$FREESCOUT_API_BASE/mailboxes/$FREESCOUT_MAILBOX_ID/custom-fields" \
|
||||||
|
-H "Authorization: Bearer $FREESCOUT_API_KEY" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{
|
||||||
|
\"name\": \"$name\",
|
||||||
|
\"title\": \"$title\",
|
||||||
|
\"type\": \"$type\",
|
||||||
|
\"required\": $required
|
||||||
|
}" \
|
||||||
|
-w "\nHTTP Status: %{http_code}\n" \
|
||||||
|
-s
|
||||||
|
else
|
||||||
|
# For select fields with options
|
||||||
|
curl -X POST "$FREESCOUT_API_BASE/mailboxes/$FREESCOUT_MAILBOX_ID/custom-fields" \
|
||||||
|
-H "Authorization: Bearer $FREESCOUT_API_KEY" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{
|
||||||
|
\"name\": \"$name\",
|
||||||
|
\"title\": \"$title\",
|
||||||
|
\"type\": \"$type\",
|
||||||
|
\"required\": $required,
|
||||||
|
\"options\": $options
|
||||||
|
}" \
|
||||||
|
-w "\nHTTP Status: %{http_code}\n" \
|
||||||
|
-s
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✅ Field created: $name"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create Field 1: AI_SUGGESTION (Text Field)
|
||||||
|
create_field "AI_SUGGESTION" "KI-Vorschlag" "text" "false"
|
||||||
|
|
||||||
|
# Create Field 2: AI_SUGGESTION_STATUS (Dropdown/Select)
|
||||||
|
create_field "AI_SUGGESTION_STATUS" "KI-Status" "select" "false" '["PENDING", "APPROVED", "REJECTED", "EXECUTED"]'
|
||||||
|
|
||||||
|
# Create Field 3: PROCESSED_BY_AI (Checkbox)
|
||||||
|
create_field "PROCESSED_BY_AI" "Von KI verarbeitet" "checkbox" "false"
|
||||||
|
|
||||||
|
echo "✅ All Freescout custom fields created successfully!"
|
||||||
Reference in New Issue
Block a user