4.0 KiB
AhaSend Email Integration Status
Current Status: ⚠️ Configuration Issue
The notification system has been successfully implemented with AhaSend integration, but the API is currently returning "invalid credentials" errors.
Configuration
Credentials (Configured)
- Account ID:
8a14f9a5-6e6d-47c9-b5d6-a687265b36a3 - Secret Key:
aha-sk-A0c9WOA8cs3RpvkAGwHOP9o6pHx-gLTUki1gSWVeC_6kd86-Npn077zta-rvg9oo - API Endpoint:
https://api.ahasend.com/v1/email
Environment Variables (.env)
AHASEND_API_KEY="aha-sk-A0c9WOA8cs3RpvkAGwHOP9o6pHx-gLTUki1gSWVeC_6kd86-Npn077zta-rvg9oo"
AHASEND_ACCOUNT_ID="8a14f9a5-6e6d-47c9-b5d6-a687265b36a3"
FROM_EMAIL="Beach Litter Platform <noreply@beachlitter.ie>"
Issue
API requests are returning:
{
"status": "invalid credentials"
}
HTTP Status: 403 Forbidden
Troubleshooting Attempts
- ✅ Verified API key is complete and correct
- ✅ Tried
X-API-KEYheader (lowercase) - ✅ Tried
Authorization: Bearerheader - ✅ Verified payload format matches API expectations
- ✅ Tested different endpoint paths
Possible Causes
- API Key Not Activated: The secret key may need to be activated in the AhaSend dashboard
- Domain Verification Required: The sending domain (
beachlitter.ie) may need to be verified - Account Status: The account may need additional setup or verification
- API Documentation: The API format may differ from what we're using
Next Steps
Option 1: Contact AhaSend Support
Reach out to AhaSend support with:
- Account ID:
8a14f9a5-6e6d-47c9-b5d6-a687265b36a3 - Issue: API returning "invalid credentials" with correct secret key
- Request: Verify API key is active and check account status
Option 2: Use SMTP Instead
AhaSend provides SMTP credentials:
- Host:
send-us.ahasend.com - Port:
587 - Username:
Fm7BA4ZxRQ - Password:
YP2trYeJ60fRRaGDzcsxzm8j
Note: SMTP credentials also returned "Invalid login" error, suggesting account-level issue.
Option 3: Alternative Email Service
Consider using:
- SendGrid: Well-documented, reliable
- AWS SES: Cost-effective for high volume
- Postmark: Great deliverability
- Resend: Modern API, developer-friendly
Testing
Run the test script:
cd server
npx tsx src/scripts/testEmail.ts
Current output:
❌ Failed to send test email to psbailey31@gmail.com
Error: { status: 'invalid credentials' }
Implementation Status
✅ Notification System: Fully implemented ✅ Database Schema: Complete with migrations ✅ API Endpoints: All working ✅ Frontend Components: NotificationBell integrated ✅ Scheduled Jobs: Event reminders and cleanup configured ✅ Email Service: Code ready, awaiting working credentials
Workaround
For immediate testing, you can:
- Mock Email Sending: Comment out actual email sending and just log
- Use Different Service: Switch to SendGrid or another provider
- Test In-App Only: Notification system works without email
Code Location
Email service implementation: server/src/services/emailService.ts
Current implementation uses:
- Axios for HTTP requests
- AhaSend REST API v1
- Proper error handling and logging
Recommendation
Contact AhaSend support to verify:
- Is the API key active?
- Does the account need verification?
- Is domain verification required?
- Are there any account restrictions?
Alternatively, switch to SendGrid which has:
- Clear documentation
- Easy setup
- Free tier (100 emails/day)
- Proven reliability
Summary
The notification system is 100% complete and ready to use. The only blocker is the AhaSend API credentials not being accepted. Once credentials are verified or an alternative email service is configured, the system will be fully operational.
All other functionality works:
- ✅ In-app notifications
- ✅ Area-of-interest matching
- ✅ Notification bell UI
- ✅ Mark as read
- ✅ Scheduled jobs
- ✅ Database storage
Email delivery is the only pending item.