Skip to content

API: Volunteers

Endpoint for volunteer registration.

Base path

/volunteers

Endpoints

POST /volunteers

Register a new volunteer. Persists the volunteer's data and returns a pre-filled WhatsApp URL to redirect the volunteer to a conversation with the institution.

Request:

LocationFieldTypeRequiredDescription
bodynamestringyesVolunteer's full name (max 255 chars)
bodyprofessionstringyesVolunteer's profession (max 255 chars)
bodyavailability.daysstring[]yesWeekdays in English (min 1). Allowed: monday, tuesday, wednesday, thursday, friday, saturday, sunday
bodyavailability.startTimestringyesStart time in HH:MM format (e.g. 16:00)
bodyavailability.endTimestringyesEnd time in HH:MM format (e.g. 19:30). Must be after startTime

Response:

StatusDescriptionBody
201Volunteer created{ id, name, profession, availability, whatsappUrl }
400Validation error{ message: string }
422Institution has no WhatsApp number registered{ message: string }

Response body fields:

FieldTypeDescription
idnumberVolunteer ID
namestringVolunteer's full name
professionstringVolunteer's profession
availability.daysstring[]Registered weekdays
availability.startTimestringStart time in HH:MM
availability.endTimestringEnd time in HH:MM
whatsappUrlstringPre-filled WhatsApp URL (https://wa.me/{number}?text={encoded_message})

Business rules:

  • availability.days must contain at least one valid weekday.
  • availability.endTime must be after availability.startTime.
  • After persisting the volunteer, the backend fetches the institution's WhatsApp number to build the whatsappUrl.
  • If the institution has no WhatsApp number, returns 422.
  • The pre-filled message follows the template: "Olá! Me chamo {name}, sou {profession} e gostaria de me voluntariar no Instituto Padre José. Tenho disponibilidade às {days} das {startTime} às {endTime}."
  • The WhatsApp number is prefixed with the Brazil country code 55: https://wa.me/55{whatsapp}?text=...