Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/diarpicu2022-commits/backend-AgroPulse/llms.txt

Use this file to discover all available pages before exploring further.

Alert recipients are the people or external services that AgroPulse notifies when an alert is dispatched for a greenhouse. Each recipient is scoped to a single greenhouse and can be reached by email, SMS phone number, or WhatsApp message through the CallMeBot gateway. Recipients can be temporarily silenced without being deleted by toggling the active flag.
The callmebotApikey field is a personal WhatsApp API key tied to an individual’s phone number. Never expose this value in client-side code, logs, or public API responses. Treat it with the same care as a password.
Set active to false on a recipient to pause notifications during maintenance windows or holidays. This avoids alert fatigue without losing the recipient’s configuration.

Endpoints

All recipient endpoints are nested under the greenhouse resource:
/api/greenhouses/{id}/alert-recipients
Modification endpoints (POST, DELETE) require the authenticated user to own the greenhouse. Requests that fail the ownership check receive a 403 Forbidden response.

List recipients for a greenhouse

Returns all alert recipients configured for the specified greenhouse.
GET /api/greenhouses/{id}/alert-recipients
Path parameters
id
number
required
The greenhouse ID whose recipients you want to list.
Response
recipients
AlertRecipient[]
required
Array of recipient objects for the greenhouse.
curl http://localhost:8080/api/greenhouses/3/alert-recipients

Add a recipient

Creates a new alert recipient for the specified greenhouse. The caller must own the greenhouse.
POST /api/greenhouses/{id}/alert-recipients
Path parameters
id
number
required
The greenhouse ID to add a recipient to.
Request body
name
string
required
Display name for the recipient. Maximum 120 characters.
email
string
Email address for alert delivery.
phone
string
Phone number for SMS delivery. Maximum 30 characters.
callmebotApikey
string
CallMeBot WhatsApp API key. Maximum 60 characters. Store this securely — see the warning above.
New recipients are created with active set to true automatically.
curl -X POST http://localhost:8080/api/greenhouses/3/alert-recipients \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Carlos López",
    "email": "carlos@example.com",
    "phone": "+34611111111"
  }'
Returns 403 Forbidden if the authenticated user does not own greenhouse {id}.

Delete a recipient

Permanently removes an alert recipient from a greenhouse. The caller must own the greenhouse.
DELETE /api/greenhouses/{id}/alert-recipients/{recipientId}
Path parameters
id
number
required
The greenhouse ID the recipient belongs to.
recipientId
number
required
The ID of the recipient to delete.
Returns { "deleted": true } on success. Returns 404 Not Found if the recipient does not exist or does not belong to the specified greenhouse. Returns 403 Forbidden if the caller does not own the greenhouse.
curl -X DELETE http://localhost:8080/api/greenhouses/3/alert-recipients/8

Build docs developers (and LLMs) love