Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Mercaline2024/Ecomdrop-ia-connector-2/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Webhooks enable real-time communication between Shopify and the Ecomdrop IA Connector. When specific events occur in your Shopify store, webhooks automatically notify the app, which then triggers configured Ecomdrop flows.Webhook Types
The app registers and handles four webhook topics:1. Orders Created (ORDERS_CREATE)
Purpose: Triggers when a new order is placed in your store Endpoint:/webhooks/orders/create
Trigger Condition: Customer completes checkout and order is created
Source File: app/routes/webhooks.orders.create.tsx
Event Flow
Event Flow
- Customer completes purchase in Shopify
- Shopify sends
ORDERS_CREATEwebhook (GraphQL format) - App validates store configuration
- If
nuevoPedidoFlowIdis configured, app formats order data - App calls Ecomdrop API to trigger the assigned flow
- Returns 200 OK to Shopify (prevents retries)
2. Draft Orders Created (DRAFT_ORDERS_CREATE)
Purpose: Triggers when a draft order is created (abandoned cart scenario) Endpoint:/webhooks/draft_orders/create
Trigger Condition: Draft order created manually or via checkout abandonment
Source File: app/routes/webhooks.draft_orders.create.tsx
Event Flow
Event Flow
- Draft order is created in Shopify
- Shopify sends
DRAFT_ORDERS_CREATEwebhook - App retrieves store configuration
- If
carritoAbandonadoFlowIdis configured, app processes draft order - App triggers Ecomdrop abandoned cart flow
- Returns 200 OK to Shopify
3. App Uninstalled (APP_UNINSTALLED)
Purpose: Cleanup when merchant uninstalls the app Endpoint:/webhooks/app/uninstalled
Source File: app/routes/webhooks.app.uninstalled.tsx
Cleanup Process
Cleanup Process
The webhook handler deletes all store data:
- Sessions (
db.session.deleteMany) - Shop Configuration (
db.shopConfiguration.deleteMany) - Product Associations (
db.productAssociation.deleteMany) - AI Configuration (
db.aIConfiguration.deleteMany)
This ensures GDPR compliance and prevents orphaned data.
4. App Scopes Updated (APP_SCOPES_UPDATE)
Purpose: Updates session when app permissions change Endpoint:/webhooks/app/scopes_update
Source File: app/routes/webhooks.app.scopes_update.tsx
Update Process
Update Process
When Shopify notifies of scope changes:
- Webhook receives new scopes in
payload.current - App updates session in database:
- Returns 200 OK
Webhook Security
Shopify webhooks use HMAC signatures to verify authenticity.Authentication Flow
App Validates Signature
The
authenticate.webhook(request) method verifies:- HMAC signature in headers
- Request origin from Shopify
- Timestamp freshness (prevents replay attacks)
The Shopify App Bridge handles webhook authentication automatically. You don’t need to implement manual verification.
Security Best Practices
Always Verify HMAC
Always Verify HMAC
Never process webhook data without validating the HMAC signature. This prevents malicious requests from triggering flows.
Return 200 for All Requests
Return 200 for All Requests
Always return HTTP 200, even on errors. This prevents Shopify from retrying failed webhooks indefinitely.
Secure API Keys
Secure API Keys
Store Ecomdrop API keys encrypted in the database. Never log them in plaintext.
Validate Payload Structure
Validate Payload Structure
Check that required fields exist before accessing them:
Webhook Payload Examples
Orders Create Payload
Draft Orders Create Payload
Webhook Processing
Data Transformation
The app transforms Shopify’s GraphQL webhook format into a simplified structure for Ecomdrop:Error Handling
Configuration Missing
Configuration Missing
If no API key or flow ID is configured:App logs warning and returns 200 (no error for Shopify).
API Call Failure
API Call Failure
If Ecomdrop API call fails:Order is tagged for manual review.
Malformed Payload
Malformed Payload
If webhook payload is invalid:Logs error and returns 200 to prevent retries.
Testing Webhooks
Using Shopify CLI
Testing in Production
Monitor Webhook Delivery
In Shopify Admin:
- Go to Settings > Notifications > Webhooks
- Click on the webhook subscription
- View delivery history and response codes
Manual Webhook Replay
You can replay failed webhooks from Shopify Admin:- Go to Settings > Notifications > Webhooks
- Click the failed webhook subscription
- Find the failed delivery
- Click “Resend” to replay the webhook
Useful for testing fixes after resolving configuration issues.
Webhook Lifecycle
Troubleshooting
Webhooks Not Firing
Webhooks Not Firing
Symptoms: No webhook logs when creating ordersSolutions:
- Verify webhooks are registered in Shopify Admin > Settings > Notifications
- Check webhook subscriptions in app configuration
- Ensure app is deployed and publicly accessible
- Review Shopify webhook delivery logs for errors
- Confirm the app has required API scopes
Webhooks Received But Not Processing
Webhooks Received But Not Processing
Symptoms: Logs show webhook received but flow doesn’t triggerSolutions:
- Check that Ecomdrop API key is configured
- Verify flow ID is assigned for the event type
- Review logs for configuration lookup failures
- Ensure shop domain matches configuration record
- Test Ecomdrop API connectivity manually
Duplicate Webhook Deliveries
Duplicate Webhook Deliveries
Symptoms: Flow triggers multiple times for single orderSolutions:
- Check Shopify webhook history for duplicates
- Verify app isn’t deployed multiple times
- Ensure webhook handler is idempotent
- Review Ecomdrop for duplicate flow executions
- Check for webhook replay actions in Shopify
Webhook Payload Errors
Webhook Payload Errors
Symptoms: App logs show missing or malformed dataSolutions:
- Log full payload to inspect structure
- Verify GraphQL vs REST format expectations
- Check Shopify API version compatibility
- Handle optional fields with safe navigation (
?.) - Add validation for required fields
Monitoring Webhooks
Key Metrics to Track
Delivery Success Rate
Monitor percentage of webhooks returning 200 OK
Processing Time
Track latency from webhook receipt to Ecomdrop API call
Flow Trigger Rate
Compare webhooks received vs flows actually triggered
Error Tags
Count orders tagged with
ecomdrop-errorLogging Best Practices
The app uses structured logging with emojis for easy filtering:📦- Order webhook received📝- Draft order webhook received🔍- Configuration lookup✅- Success❌- Error⚠️- Warning🚀- Flow trigger
API Reference
Webhook Endpoints
| Endpoint | Method | Topic | Purpose |
|---|---|---|---|
/webhooks/orders/create | POST | ORDERS_CREATE | New order processing |
/webhooks/draft_orders/create | POST | DRAFT_ORDERS_CREATE | Abandoned cart flow |
/webhooks/app/uninstalled | POST | APP_UNINSTALLED | Data cleanup |
/webhooks/app/scopes_update | POST | APP_SCOPES_UPDATE | Permission sync |
Webhook Authentication
All webhooks must include Shopify HMAC headers:Next Steps
Store Settings
Configure API keys and integration settings
Flow Management
Set up and test Ecomdrop flows