GithubHelp home page GithubHelp logo

echo bot example about webwhatsapp-wrapper HOT 8 CLOSED

mukulhase avatar mukulhase commented on July 17, 2024 1
echo bot example

from webwhatsapp-wrapper.

Comments (8)

mukulhase avatar mukulhase commented on July 17, 2024

We are planning to add an easier way to create bots, like a hook or a callback.

import time
from webwhatsapp import WhatsAPIDriver
driver = WhatsAPIDriver()

# Waits for page to initialize completely
driver.firstrun()

print "bot started!"
while True:
    #polling period
    time.sleep(1)

    contacts = driver.view_unread();
    for contact in contacts:

        ##filters here
        if "Mom" in contact[u"contact"]:

            ##iterating through recent messages
            for message in contact[u"messages"]:
                ##message here
                print message
                driver.send_to_id(contact[u"id"], contact[u"contact"], "hello" + message[u"message"]) 

from webwhatsapp-wrapper.

Theblood avatar Theblood commented on July 17, 2024

wow ! , It's great what they've created me I liked it, thank you for the example , dear thank you very much !

from webwhatsapp-wrapper.

Theblood avatar Theblood commented on July 17, 2024

@mukulhase
AttributeError: WhatsAPIDriver instance has no attribute 'send_to_id'

from webwhatsapp-wrapper.

Theblood avatar Theblood commented on July 17, 2024

bot started {u'timestamp': 1470091884, u'message': u'tengo pokemon go pero no me saleniun pokemos'} Traceback (most recent call last): File "bot.py", line 16, in <module> driver.send_to_id(contact[u"id"], contact[u"contact"], "hello" + message[u"message"]) AttributeError: WhatsAPIDriver instance has no attribute 'send_to_id'

from webwhatsapp-wrapper.

mukulhase avatar mukulhase commented on July 17, 2024

I'm not getting this error, could you please check if you are using the latest code?

from webwhatsapp-wrapper.

Theblood avatar Theblood commented on July 17, 2024

@mukulhase sorry this error was because im not update code .. sorry my inglish :C

from webwhatsapp-wrapper.

Harshaddarji avatar Harshaddarji commented on July 17, 2024

@mukulhase I am getting below error . How can we resolve these issue.

bot started!
Traceback (most recent call last):
File "E:\Python\WhatsAPI-master\sample.py", line 13, in
contacts = driver.view_unread();
File "E:\Python\WhatsAPI-master\webwhatsapp.py", line 152, in view_unread
Store = self.driver.execute_script(script)
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\site-package
s\selenium\webdriver\remote\webdriver.py", line 465, in execute_script
'args': converted_args})['value']
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\site-package
s\selenium\webdriver\remote\webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\site-package
s\selenium\webdriver\remote\remote_connection.py", line 401, in execute
return self._request(command_info[0], url, body=data)
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\site-package
s\selenium\webdriver\remote\remote_connection.py", line 432, in _request
self._conn.request(method, parsed_url.path, body, headers)
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\http\client.
py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\http\client.
py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\http\client.
py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\http\client.
py", line 1026, in _send_output
self.send(msg)
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\http\client.
py", line 964, in send
self.connect()
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\http\client.
py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\socket.py",
line 722, in create_connection
raise err
File "C:\Users\AMIT\AppData\Local\Programs\Python\Python36-32\lib\socket.py",
line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the
target machine actively refused it

from webwhatsapp-wrapper.

matheuscorreiacardoso avatar matheuscorreiacardoso commented on July 17, 2024

hello, i'm trying to use the API, but i have a doubt.

What is the variable Store on get_unread_messages.js script?

can i change the value of it? Just to get selected chat?

from webwhatsapp-wrapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.