← back to Designer Wallcoverings
DW-Agents/dw-agents/get-amazon-api-credentials.sh
108 lines
#!/bin/bash
# Amazon Associates & PA-API Credential Helper
# This script will help you input your credentials once you get them
echo "🎯 Amazon Product Advertising API - Credential Setup"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "📋 Follow these simple steps:"
echo ""
echo "1️⃣ Open this link in your browser:"
echo " 👉 https://affiliate-program.amazon.com/"
echo ""
echo "2️⃣ Sign in with: nataliaabrams@gmail.com"
echo ""
echo "3️⃣ Click 'Join Now for Free' or 'Sign Up'"
echo ""
echo "4️⃣ Fill in the application:"
echo " • Website: https://www.designerwallcoverings.com"
echo " • Website Name: Designer Wallcoverings"
echo " • Preferred Store ID: designerwallcoverings-20"
echo " • Topics: Home & Garden, Office Products"
echo " • How you'll use links: Office supply recommendations and blog"
echo ""
echo "5️⃣ After approval, go to: Tools → Product Advertising API"
echo ""
echo "6️⃣ Click 'Add Credentials' or 'Manage Credentials'"
echo ""
echo "7️⃣ Copy your 3 credentials:"
echo " • Access Key ID"
echo " • Secret Access Key "
echo " • Partner Tag (your Associate ID)"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "🔑 Ready to enter credentials? (y/n)"
read -r ready
if [ "$ready" != "y" ]; then
echo ""
echo "No problem! Run this script again when you have your credentials."
echo ""
echo "Quick link: https://affiliate-program.amazon.com/"
echo ""
exit 0
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🔑 Enter Your Credentials"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Get credentials
echo "📝 Access Key ID (looks like: AKIAIOSFODNN7EXAMPLE):"
read -r access_key
echo ""
echo "📝 Secret Access Key (looks like: wJalrXUtnFEMI/K7MDENG...):"
read -r secret_key
echo ""
echo "📝 Partner Tag / Associate ID (looks like: yourname-20):"
read -r partner_tag
# Create .env file
ENV_FILE="/root/DW-Agents/.env"
echo ""
echo "💾 Saving credentials to $ENV_FILE..."
cat > "$ENV_FILE" << EOF
# Amazon Product Advertising API Credentials
PAAPI_ACCESS_KEY=$access_key
PAAPI_SECRET_KEY=$secret_key
PAAPI_PARTNER_TAG=$partner_tag
PAAPI_HOST=webservices.amazon.com
PAAPI_REGION=us-east-1
# Anthropic API Key
ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
EOF
echo "✅ Credentials saved!"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🧪 Testing Your Credentials..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
cd /root/DW-Agents
npx tsx amazon-paapi-integration.ts
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✅ Setup Complete!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "🔄 Restarting purchasing agent with real Amazon data..."
pm2 restart dw-purchasing-office
echo ""
echo "🎉 Done! Your agent now has REAL Amazon pricing!"
echo ""
echo "Visit: http://45.61.58.125:9880"
echo "Login: admin / 2025"
echo ""