The Reds were paired with the German side during Friday’s draw in Nyon and the clubs will now clash over two legs for the right to progress to the tournament’s group stages.
Jürgen Klopp’s team will travel to his homeland for the opening match of the tie on August 15 before hosting the second game at Anfield on August 23.
Liverpool secured a spot in this round of the competition by finishing fourth in the Premier League last term, while Hoffenheim finished in the same position in the Bundesliga.