Yes, it is possible through Selenium without using any kind of API.
First we will import required modules:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
import time
Now we will launch Whatsapp Web:
driver = webdriver.Chrome()
driver.get("https://web.whatsapp.com")
You can use other browsers, for this example we will be using Chrome.
Now we will locate the Search or Start New Chat button using XPath and add a webdriver wait for it:
search_button = WebDriverWait(driver,50).until(lambda driver: driver.find_element_by_xpath("//input[@title='Search or start new chat']"))
Now we will click it and add a little sleep:
search_button.click()
time.sleep(2)
Now we will Send the name of the Person to contact into the text area:
search_button.send_keys("A")
time.sleep(2)
Now we will send a message
input_box = driver.find_element_by_xpath(r'//div[@class="_2S1VP copyable-text selectable-text"][@contenteditable="true"][@data-tab="1"]')
time.sleep(2)
input_box.send_keys("Hello" + Keys.ENTER)
time.sleep(2)
You can using Chrome inspect more and do more things.