How to send a text in python WhatsApp

I was creating a program to automatically send messages via WhatsApp, but I have a very annoying problem. I want to send a large text for dissemination, when I put the program to work, it opens WhatsApp, I scan the QR CODE, it searches the groups and sends messages, but sends it as if it were several messages. What I want is for you to send a message with the entire text. I live in Brazil and I’m using google translator to write this question, sorry for the spelling errors.

# importar as bibliotecas 
from selenium import webdriver
import time
from import ChromeDriverManager
from selenium.webdriver.common.keys import Keys

# navegar até o WhatsApp web
driver = webdriver.Chrome(ChromeDriverManager().install())

# Definir contatos e grupos e msg para ser enviado
contatos = ['test 1', 'test 2', 'test 3']
mensagem = '''

Plantão de 12h apenas Diurno das 07:00h as 19:00h

 19/07 - Segunda Feira
 26/07 - Segunda Feira

 02/08 - Segundo Feira
 09/08 - Segunda Feira 
 16/08 - Segunda Feira 
 23/08 - Segunda Feira 
 30/08 - Segunda Feira

Pagamento semanal liquido!


Boa estrutura, local muito bom para fazer plantão

# buscar contato ou grupo
def buscar_contato(contato):
    campo_pesquisa = driver.find_element_by_xpath('//div[contains(@class,"copyable-text selectable-text")]')

def enviar_mensagem(mensagem):
    campo_mensagem = driver.find_elements_by_xpath('//div[contains(@class,"copyable-text selectable-text")]')
for contato in contatos:

# Campo de pesquisa 'copyable-text selectable-text'
# Campo de msg privado 'copyable-text selectable-text'
# enviar mensagem para contato ou grp

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there

I recently made a python library that abstracts selenium and provides an easy and intuitive interface plus advanced control over the WhatsApp Web, you really wanna have a look at it, I’m pretty sure you will love it

Here is a link

Here how to send a message to the user

>>> from alright import WhatsApp
>>> messenger = WhatsApp()
>>> messenger.find_user('2557xxxxxz')
>>> messages = ['Morning my love', 'I wish you a good night!']
>>> for message in messages:  

Thank you Kalebu


According to the official WhatsApp documentation, the maximum limit for text updates is 700 characters. If the message you are sending is longer than that, then it would explain why it gets split into multiple ones.

Regards, Bobby