GET
/
api
/
cron
/
send-feedback-email
Send Feedback Email
curl --request GET \
  --url https://onlyautomator.com/api/cron/send-feedback-email \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "count": 1,
  "testMode": true,
  "message": "Feedback email successfully sent to test address"
}
This endpoint triggers the sending of feedback request emails to users who have been using the service for a certain period of time. It can be used to send a single test email or to process all eligible users.

Authentication

This endpoint requires API key authentication.

Query Parameters

testEmail
string
Optional. If provided, sends a test feedback request email to this address instead of to actual users.

Response

success
boolean
Indicates whether the operation was successful
count
number
Number of emails sent
testMode
boolean
Indicates if the endpoint was run in test mode
message
string
Status message about the operation

200 OK (Test Mode)

{
  "success": true,
  "count": 1,
  "testMode": true,
  "message": "Feedback email successfully sent to test address azzhh@indigobook.com"
}

200 OK (Production Mode)

{
  "success": true,
  "count": 25,
  "testMode": false,
  "message": "Feedback emails successfully sent to 25 users"
}

400 Bad Request

{
  "success": false,
  "message": "Invalid email format",
  "error": "The provided test email address is not valid"
}

401 Unauthorized

{
  "success": false,
  "message": "Unauthorized. Invalid or missing API key."
}

Example Usage

// Send a test feedback request email
const testFeedbackEmail = async () => {
  const apiKey = "YOUR_API_KEY";
  const response = await fetch('http://localhost:3000/api/cron/send-feedback-email?testEmail=azzhh@indigobook.com', {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${apiKey}`
    }
  });
  
  const data = await response.json();
  console.log(data);
};

// Trigger the actual job for sending feedback request emails to all eligible users
const sendFeedbackEmails = async () => {
  const apiKey = "YOUR_API_KEY";
  const response = await fetch('http://localhost:3000/api/cron/send-feedback-email', {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${apiKey}`
    }
  });
  
  const data = await response.json();
  console.log(data);
};

Email Template

The feedback request email is designed to solicit feedback from users about their experience with the OnlyAutomator platform. It includes:
  • Personalized greeting with the user’s first name
  • Request for feedback on their experience
  • Direct link to a feedback form or survey
  • Explanation of how feedback helps improve the service
  • Information about future updates based on feedback
  • Thank you message
  • Support contact information

Implementation Notes

  • This endpoint is designed to be called by a scheduled task (cron job)
  • When called without a testEmail parameter, it will find all users who have been active for at least 14 days
  • The endpoint ensures users don’t receive feedback requests more than once per month
  • The endpoint is rate limited to prevent accidental mass emails
  • In production, authentication via API key is required
  • Email sending is logged for audit purposes

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

testEmail
string

Test email address to which the email will be sent

Response

Operation successful

success
boolean
Example:

true

count
integer
Example:

1

testMode
boolean
Example:

true

message
string
Example:

"Feedback email successfully sent to test address"