Coder Social home page Coder Social logo

nemo's Introduction

NeMo Whataspp ChatBot

Customizeable Whatsapp chatbot with simply creating a YML file to configure the bot, very easy to configure.

Why you need this ? imagine you want to automate your shop order or catalog your shop, or just simply don't want to reply some annoying friend

The tools is awesome it just the documentation that looks shitty, help me to fix the documentation :(

This tools is the study case research from the eFishery to solve problem "How might we gather data supply from farmer it self" so we create a bot whatsapp because farmer is very familiar with whatsapp and facebook rather than with new apps

Showcase

NeMo as the WhatsApp Shop Online Assistant

How it work

You need to test the NeMo is connected with your device and then you create the YAML file as the Bot Configuration and then test the bot by triggering the bot from the keyword registered at configuration, the configuration is called coral, you can learn about the coral configuration in here Understanding Coral Configuration

NeMo is using the reverse engineered whatsapp web from here sigalor/whatsapp-web-reveng, this is the only reason why the requirement need the screen is stay awake and focus on whatsapp application, we are using Rhymen/go-whatsapp for the golang library

Nemo is also using the randomizer pause chat depends on how many word is typed, its like how typical human type the word 1-3 secon perword, also NeMo will sent the "typing" mode so the whatsapp will thinking that we are as the person

Requirements

  1. android phone connected to pc/laptop

  2. the android phone need to enable the settings "Stay awake" (screen will never sleep while charging), "USB Debugging", "Install via USB"

    you need to enable this so you can connect your device with your pc/laptop

  3. the screen stay on whatsapp appplication

    you need to do this so the nemo will not interupted, because the nemo is using the web.whatsapp.com API so the device need to be always connected to internet

How to run

to run you need to have enviroment variable as in .env.example, rename it to .env, by default you need to create coral dir or you can specify by env var CORAL_DIR. The coral dir is for the bot configuration written in YAML format, to create a coral directory and put all the coral file in this folder, also you need the WhatsApp session file in order to connect to the current phone

Use this tools to generate the whatsapp session file k1m0ch1/WhatsappLogin, you can download the latest binary file from the latest release

and run with command ./WhatsappLogin -p 08123123123 and scan the QR

after you have file 08123123123.gob and coral directory with basic.yml inside, run the NeMo with this command

./NeMo 08123123123

this will find the file 08123123123.gob in the SESSION_DIR environment variable by default this will goes to current directory running file

Run on Development

Use the makefile and run this on command make run p=<the-file-session>

Run With Docker

you must prepare the coral directory include with yaml file and Whatsapp file session, after that mount volume in docker with example command like this

docker run \
--name NeMo -v $(pwd)/coral:/app/coral \
-v $(pwd)/.sessions/08123123123.gob:/app/08123123123.gob \
k1m0ch1/nemo 08123123123

The configuration is called coral, you can learn about the coral configuration in here Understanding Coral Configuration

To Do

[] need to validate if the ChatBot already sent the message, so he will not sent a duplicate message

[] weird file session JSON error parsing, weirdly added the "":"} string in the end

[] build for ANY expected users, along with the builder

[] if error logging in, try to re-login

[] YAM file can be .yaml or .yml, currently only yml is validated

Done List

[] Multi Schedule is not

[] Multi file yml with some with no greeting or no schedule or no commands

[] must test all the builder work well

[] ~ada orang yang nyangkut gara gara status NEXT nya diem, bisanya nge break pas ada ~

[] semua bentuk dokumen harus di kasih handler

[] ada orang yg kirim gambar langsung tanpa command atau session apapun, langsung ngebreak soalnya dia mencoba coral yg tidak exist

[] kirim gambar langsung modar

[] ga ada sesinya langsung modar, masalah di image handler

nemo's People

Contributors

k1m0ch1 avatar pniedzwiedzinski avatar ronaudinho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nemo's Issues

Made NeMo can parsing image

URL parsing right now is working like {URL} will get the response key with message key, so I think the {URL} need to be working with image as well, I think we need a checker, so whenever URL response is image it will upload the image first along with message as label.

for example

...
  message: "helo {URL_IMAGE} welcome to here"
...

this will sent image with caption "hello welcome to here"

but if example like this

...
  message : "{URL_FIRST} hello to see the image like this {URL_SECOND} you need to continue {URL_THIRD}"
...

this will sent image URL_FIRST and URL_SECOND without caption and then URL_THIRD with caption "hello to see the image like this you need to continue"

NeMo can parse image from REST API response

Response from the REST API with this example need to handle a new reply with sent image include with the caption

{
   "message": "normal message",
   "images" : [
       {
           "URL": "url",
           "caption": "caption"
       }
   ]
}

process question condition

the condition key in the question is to handle if the question is valid to be asked or not, the question process suppose to be sequentially, so this will be good for custom conditional

conditional using abbreviation
eq as Equal
gte Greater Than or Equal
lte less than or equal
lt less than
neq not equal
in with the function like in('compare stirng', 'compare string')

coral config must be like this

...
- question:
  slug: third
  asking: some word
  validation:
    rule: *
    message: ""
  condition: first eq 'hello'
...

This need to be added on sessions too

if the condition is not meet, the data on sessions must be included but with value null

Webhook bug sent the datat to `POST /`

Whenever the user using the webhook, and the log data is sent to the REST API, the NeMo will also sent a full data to the index route /, but it suppose to be working with the URL webhook that already registered1. Whenever the user using the webhook, and the log data is sent to the REST API, the NeMo will also sent a full data to the index route /, but it suppose to be working with the URL webhook that already registered

Set this to can't reproduct, because tested to any configuration and perfectly fine

Session Disconnected Handler

when session is used by another whatsapp web, usually show this error

2020/10/15 21:56:23 error occoured: server closed connection,code: 1000,text: 
  • So this will be much better if the error telling the session is used, and asked if wanted to reload
  • add the general configuration (.env) with variable name FORCE_LOGIN by default is False so when used will be asking, if True will never asking and re-login the whatsapp

Default greeting will show whenever the user input the "command" on the "process" time

With the default greeting, NeMo need to understand if any keyword that registered are not responded with the default greeting

to produce this bug, just create a simple configuration with default greeting and process

so whenever you start to run the process, try to answer with the current command, it will respond with the process configuration
image

What suppose to be ?
"process" function is will do not start process again whenever the command is typed.

Made NeMo can parse more than one URL

currently if you use {URL} format it will be access the URL and parse the message key value as message, but weirdly its only working one format, I need to work for many format

Add Makefile

I think better if we have Makefile to make it easier people to build this from scratch

Made the NeMo can using `expected_users` for `any` users

I think NeMo will be better if we can use any for expected_users instead of a list of number, but the challenge came from :

  1. default_greeting can only be one for every number If expected_users is set to any, need a validator when build, so only single deafult_greeting is compiled
  2. the command is expected handler change to any users
  3. scheduler can't be activated when expected_users to any, so made another one to specific user.
  4. prevent the chat is replied to trigger commands or greeting to group, domain of @g.us
  5. don't reply to user if message.Info.FromMe is true

Prevent ChatBot to sent the same message from a range of time`

I can't give you the detail, but when the NeMo is idle, sometime error triggered and container configuration is always restart and will sent message again, so it will be better if NeMo check the last message is not same as with the message to be sent

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.