The disclosure provides compositions and methods related to activating alpha-kinase 1 (ALPK1) for modulating an immune response and treating or preventing cancer, infection, inflammation and related diseases and disorders as well as potentiating an immune response to a target antigen. The disclosure also provides heterocyclic compounds of formula (I) as agonists of alpha protein kinase 1 (ALPK1) and their use in activating ALPK1, modulating an immune response and treating diseases such as cancer, wherein A1, A2, L1, L2, L3, Z1, Z2, W1, W2, R1, R2, R3, R4, R5, R6 and R7 are defined herein.