In Matthew 1:18-25- Joseph who was engaged to Mary had a dream in which an angel told him what was going to happen.
Matthew 1:20-22 (ESV)
behold, an angel of the Lord appeared to him in a dream, saying, “Joseph, son of David, do not fear to take Mary as your wife, for that which is conceived in her is from the Holy Spirit.
She will bear a son, and you shall call his name Jesus, for he will save his people from their sins.” 22 All this took place to fulfill what the Lord had spoken by the prophet:
Then Joseph got the message in a dream and it must have been a very vivid dream.