The first spikes are typically from sensory organs and arise from depolarization of the sensory cell by an external stimulus. This can happen in many different ways, but common for all sensory cells is that there are specialized ion channels that will open in response to the right stimulus (termed the adequate stimulus). Chemoreceptors, involved in taste and smell, have membrane channels that work in the same way as postsynaptic transmitter channels, except that they are triggered by whatever molecule or modecule-group they are sensitive to, rather than sensitive to transmitter molecules. Binding of the right molecule to the receptor channel (either directly, or indirectly through second-messenger systems) will lead to an influx of typically Ca, causing a depolarizing receptor potential, which triggers the action potential. Mechanoreceptors have membrane channels that respond by opening for Ca-influx simply by the physical deformation of the membrane (through an extremely diverse range of modifications and elaborate support structures). Sound-sensitive receptors, such as hair cells in vertebrate ears, are also mechanoreceptors, stimulated by the motion caused by sound waves. Photo-receptors typically work by second-messenger systems internally in the receptor cell, where absorption of a photon by a suitable photopigment results in a cascade that leads to release of second messengers, such as GTP, which then bind and trigger the opening of Ca channels.
An interesting special case is electroreceptors, found in sharks, many fish and al few mammals. Here the depolarization of the receptor cell is directly caused by the adequate stimulus: the change in the electric field.