Rahab the prostitute protects the two Israelite spies from harm.
This happened before the king's messenger spoke to her.
This refers to Rahab, the prostitute.