A Node.js application that combines Shopify's API with OpenAI to provide intelligent order lookup and natural language responses to customer inquiries. This integration helps automate customer service by extracting order information from customer messages and providing both structured data and human-like responses.
- 🔍 Intelligent order number extraction from customer messages
- 🛍️ Seamless Shopify order lookup and verification
- 🤖 AI-powered natural language responses
- 🔒 Secure API key management
- 🚀 Easy to deploy and customize
Before you begin, ensure you have:
- Node.js (v14 or higher) installed
- A Shopify store with API access
- An OpenRouter API key
- Basic knowledge of REST APIs
-
Clone the repository:
-
Install dependencies:
npm install
- Set up your environment:
cp .env.example .env
-
Configure your
.env
file: -
Start the server:
npm start
- Never commit your
.env
file - Keep your API keys secure
- Use environment variables for sensitive data
- Implement rate limiting in production
- Add authentication for the API endpoints in production
POST /api/process-customer-text
Request body:
{
"text": "Hi, what's the status on #5033?"
}
Response:
{
"success": true,
"extractedInfo": {
"orderId": "5033"
},
"orderFound": true,
"orderDetails": {
"id": "123456789",
"orderNumber": "5033",
"createdAt": "2024-01-16T00:00:00Z",
"totalPrice": "99.99",
"fulfillmentStatus": "fulfilled",
"customer": {
"email": "customer@example.com",
"name": "John Doe"
},
"shippingAddress": {
"address1": "123 Main St",
"city": "Example City",
"province": "State",
"zip": "12345",
"country": "Country"
}
},
"naturalResponse": "Hi! I can help you with order #5033. The order is currently fulfilled and was shipped to 123 Main St, Example City. Is there anything specific about the order you'd like to know?"
}
- Go to your Shopify admin panel
- Navigate to Apps > Develop apps
- Create a new app
- Generate an access token with the required permissions
- Copy your store's subdomain (from your myshopify.com URL)
Contributions are welcome! Please feel free to submit a Pull Request.
The API uses standard HTTP status codes:
- 200: Success
- 400: Bad Request (e.g., no text provided)
- 500: Server Error (e.g., API failures)
This project is licensed under the ISC License - see the LICENSE file for details.
For support, please open an issue in the GitHub repository.