Compounds of the formula I: or a pharmaceutically acceptable salt thereof, wherein, R1 is a group of formula A or formula B, and X, R2, R3, R4, R5, R6, Ra and Rb are as defined herein. Also provided are methods of using the compounds for treating diseases mediated by a P2X3 and/or a P2X2/3 receptor antagonist and methods of making the subject compounds.