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.

AgroPulse can notify people by email and WhatsApp when alerts are triggered in a greenhouse. Recipients are scoped to a single greenhouse — each greenhouse maintains its own list, so you can configure different contacts for different sites. A recipient can receive email notifications, WhatsApp messages via CallMeBot, or both, depending on which fields you provide.
Start by adding a single recipient (yourself) and trigger a test alert before rolling out notifications to your full team. This confirms your email address and CallMeBot API key are working before you add everyone else.

Adding recipients

Post to /api/greenhouses/{id}/alert-recipients with a name and email. The active field defaults to true so the recipient receives notifications immediately.
curl -s -X POST http://localhost:8080/api/greenhouses/1/alert-recipients \
  -H "Content-Type: application/json" \
  -d '{
    "name": "María García",
    "email": "maria.garcia@example.com"
  }'
{
  "id": 4,
  "greenhouseId": 1,
  "name": "María García",
  "email": "maria.garcia@example.com",
  "phone": null,
  "callmebotApikey": null,
  "active": true
}

Listing recipients for a greenhouse

curl "http://localhost:8080/api/greenhouses/1/alert-recipients"
{
  "recipients": [
    {
      "id": 4,
      "greenhouseId": 1,
      "name": "María García",
      "email": "maria.garcia@example.com",
      "phone": null,
      "callmebotApikey": null,
      "active": true
    },
    {
      "id": 5,
      "greenhouseId": 1,
      "name": "Carlos López",
      "email": null,
      "phone": "+34612345678",
      "callmebotApikey": "123456",
      "active": true
    }
  ]
}

Removing a recipient

Delete a recipient by ID. You must also supply the greenhouse ID in the path — the API verifies that the recipient belongs to that greenhouse before deleting.
curl -s -X DELETE http://localhost:8080/api/greenhouses/1/alert-recipients/5
Response: {"deleted": true} If the recipientId does not belong to the specified greenhouse, the API returns 404 Not Found.

Access control

Only the greenhouse owner or an ADMIN user can add or remove alert recipients. Requests from other users will receive a 403 Forbidden response.

Build docs developers (and LLMs) love