The ties on August 18 and August 25 will be a repeat of the tie last season when Astra beat the Hammers in the third qualifying round.
Slaven Bilic's West Ham reached this stage with a 3-0 win over Slovenian outfit NK Domzale, 4-2 on aggregate, in their first game at the Olympic Stadium, now called the London Stadium.
2009 champions Shakhtar Donetsk, who reached the semi-finals last season, take on Istanbul Basaksehir.