【问题标题】:How to automate web whatsapp to send messases with win32 api and pyautogui?如何自动化 web whatsapp 以使用 win32 api 和 pyautogui 发送消息?
【发布时间】:2021-02-15 02:01:55
【问题描述】:

谁能告诉我如何自动化网络 WhatsApp 向联系人列表中的每个人发送消息 或者建议我一个更好的选择,只要记住我不能购买付费 API。

【问题讨论】:

  • 用网络浏览器打开web.whatsapp.com/send?phone={phone}&text={text}。之后,sleep 3,点击回车发送。
  • 我已将此作为答案发布。

标签: python winapi automation whatsapp pyautogui


【解决方案1】:

您可以使用 web.whatsapp.com 网址:

import webbrowser
import time
import pyautogui
phone = "12345678901"
text = "my message"
webbrowser.open(f"https://web.whatsapp.com/send?phone={phone}&text={text}&app_absent=0")
time.sleep(9) # wait for whatsapp web
pyautogui.click() # move your mouse to textbox before
pyautogui.press("enter")

【讨论】:

    【解决方案2】:

    我尝试了 matan h 的答案,发现了几个错误。

    我已经更新了下面代码中提到的 URL。

    import webbrowser
    import time
    import pyautogui as gui
    
    m_number = '91987654321'  #country code and mobile number without '+' symbol
    message = "You........"
    url = 'https://web.whatsapp.com/send?phone='+m_number+'&text='+message+'&app_absent=0'
    webbrowser.open(url)
    time.sleep(10) #loading page time
    gui.press('enter')
    

    【讨论】:

    • 插入代码时请使用正确的格式
    • 谢谢,我已经修正了我的回答中的错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-16
    • 1970-01-01
    • 2018-09-01
    • 1970-01-01
    • 2022-12-18
    • 1970-01-01
    相关资源
    最近更新 更多