Control of atom-photon interactions with shaped quantum electron wavepackets