Which is the first group of animals that have endocrine system?

Which is the first group of animals that have endocrine system? How pheromones work in insects?

Arthropods are the first animals to have endocrine system. Some insects release pheromones
that act as sex attractants by which males can locate females far away from them.