Responding to a message in the script

Hello,

I would like to write a script that responds to a specific message.
Example: echo “reboot” | ssh user@ip
Returns the message “user@ip’s password:”
After the message is displayed, the script should enter a specific value.

Unfortunately, I don't know how to achieve it.