Whatsapp API dan Notifikasi WHMCS


susan

Apprentice 2.0
bisa menggunakan API tuan, untuk endpoint dan variable nya sudah dideskripsikan di github, atau bisa cek di page sebelumnya
service sdh jalan, bot sdh jalan, coba kirim wa msh error. kenapa ya?

Code:
TypeError: Cannot read properties of undefined (reading 'substring')
    at /root/Whatsapp-WHMCS/index.js:41:34
    at Layer.handle [as handle_request] (/root/Whatsapp-WHMCS/node_modules/express/lib/router/layer.js:95:5)
    at next (/root/Whatsapp-WHMCS/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/root/Whatsapp-WHMCS/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/root/Whatsapp-WHMCS/node_modules/express/lib/router/layer.js:95:5)
    at /root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:346:12)
    at next (/root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:280:10)
    at urlencodedParser (/root/Whatsapp-WHMCS/node_modules/body-parser/lib/types/urlencoded.js:100:7)
    at Layer.handle [as handle_request] (/root/Whatsapp-WHMCS/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:328:13)
    at /root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:346:12)
    at next (/root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:280:10)
    at jsonParser (/root/Whatsapp-WHMCS/node_modules/body-parser/lib/types/json.js:119:7)
    at Layer.handle [as handle_request] (/root/Whatsapp-WHMCS/node_modules/express/lib/router/layer.js:95:5)
 

ComputingID

Poster 1.0
service sdh jalan, bot sdh jalan, coba kirim wa msh error. kenapa ya?

Code:
TypeError: Cannot read properties of undefined (reading 'substring')
    at /root/Whatsapp-WHMCS/index.js:41:34
    at Layer.handle [as handle_request] (/root/Whatsapp-WHMCS/node_modules/express/lib/router/layer.js:95:5)
    at next (/root/Whatsapp-WHMCS/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/root/Whatsapp-WHMCS/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/root/Whatsapp-WHMCS/node_modules/express/lib/router/layer.js:95:5)
    at /root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:346:12)
    at next (/root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:280:10)
    at urlencodedParser (/root/Whatsapp-WHMCS/node_modules/body-parser/lib/types/urlencoded.js:100:7)
    at Layer.handle [as handle_request] (/root/Whatsapp-WHMCS/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:328:13)
    at /root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:346:12)
    at next (/root/Whatsapp-WHMCS/node_modules/express/lib/router/index.js:280:10)
    at jsonParser (/root/Whatsapp-WHMCS/node_modules/body-parser/lib/types/json.js:119:7)
    at Layer.handle [as handle_request] (/root/Whatsapp-WHMCS/node_modules/express/lib/router/layer.js:95:5)
mungkin untuk format nomornya pakai kode negara misal 62 dan pastikan tipe data yang dikirim berupa string bukan number :)
 

WarnaHost

Expert 2.0
Verified Provider
kalau kita jalankan manual tanpa cron nanti tampil kok tuan untuk status pengiriman pesannya, jika pake cron mungkin bisa ditambahkan aja di cron nya untuk simpan log
* * * 8 * python3 /root/Whatsapp-WHMCS/whmcs/unpaid.py >> /var/log/whatsapp.log 2>&1
Saya coba error. Posisi perangkat aktif + sedangmenyinkronkan

Code:
# python3 invoice_duedate.py >> /var/log/whatsapp.log

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 169, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 96, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 86, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 234, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/lib/python3.9/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1010, in _send_output
    self.send(msg)
  File "/usr/lib/python3.9/http/client.py", line 950, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 200, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 181, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f9a46cdd100>: Failed to establish a new connection: [Errno 111] Connec                                    tion refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /api/send (Caused by NewConnectionError('<u                                    rllib3.connection.HTTPConnection object at 0x7f9a46cdd100>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/www/Whatsapp-WHMCS/whmcs/invoice_duedate.py", line 26, in <module>
    sendMessage = requests.post(url, json = data)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /api/send (Caused by NewConnectionError(                                    '<urllib3.connection.HTTPConnection object at 0x7f9a46cdd100>: Failed to establish a new connection: [Errno 111] Connection refused'))
 

ComputingID

Poster 1.0
ConnectionRefusedError: [Errno 111] Connection refused
kemungkinan service api nya tuan, mungkin bisa coba dijalankan ulang service api wa nya & cek port nya, default port nya 8080
jika api sudah sukses running nanti ada notifikasi Hello world app listening on port xxx

jika ip address dan port api nya berbeda, di script python nya bisa diubah di antara line 24 seberti dibawah:
1687416978292.png
 

Top