Kameron Abbas was shocked when he received the bigoted message but requested another and received a second racist joke.
The text said: "How do you save a drowning Pakistani? Take your foot off his head."
Abbas said he and his friend Imran Shah had texted the service for a laugh after seeing an ad promoting it on TV.
He said: "We couldn't believe the response. It was like Bernard Manning. These jokes are not funny. They promote racism."
The service costs 60p per joke and is operated by 118 118 from several call centres.
A spokesperson for the directory service said: "118 118 has apologised unreservedly to Mr Abbas.
"The employee who sent the highly inappropriate text has been reprimanded. We are putting our operators through further training to minimise a repeat of such an incident in the future."