wppconnect-team / wppconnect-server

Wppconnect Server is a ready-to-use API, just download, install, and start using, simple as that.
https://wppconnect.io/swagger/wppconnect-server/
Apache License 2.0
676 stars 395 forks source link

Post request to /send-message, it returns the error: n.match is not a function #1467

Closed lsouzapedroso closed 1 year ago

lsouzapedroso commented 1 year ago

Description

When sending a post request to /send-message, it returns the error: n.match is not a function, only for the send message, the other functions do not exhibit this behavior, such as send-file-base64.

Environment

Steps to Reproduce

  1. Send a post request to wppconnect-server using the wppconnect-laravel-client

Log Output

error: 2023-08-29T22:06:37.87 8Z n.match is not a function - Error: n.match is not a function at /usr/src/wpp-server/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:107:31 at step (/usr/src/wpp-server/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:49:23) at Object.next (/usr/src/wpp-server/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:30:53) at fulfilled (/usr/src/wpp-server/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:21:58) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) JS Stack: TypeError: n.match is not a function at t.prepareRawMessage (/usr/src/wpp-server/node_modules/@wppconnect/wa-js/dist/wppconnect-wa.js:2:168316) at async t.sendRawMessage (/usr/src/wpp-server/node_modules/@wppconnect/wa-js/dist/wppconnect-wa.js:2:177395) at async t.sendTextMessage (/usr/src/wpp-server/node_modules/@wppconnect/wa-js/dist/wppconnect-wa.js:2:178679) at async pptr:evaluate;%2Fusr%2Fsrc%2Fwpp-server%2Fnode_modules%2F%40wppconnect-team%2Fwppconnect%2Fdist%2Fapi%2Fhelpers%2Fevaluate-and-return.js%3A99%3A56:56:26 Function: function (_a) { var to = _a.to, content = _a.content, options = _a.options; return WPP.chat.sendTextMessage(to, content, assign(assign({}, options), { waitForAck: true })); }

Your Code

                      Wppconnect::make($this->url);
                       $response = Wppconnect::to('/api/' . $this->session . '/send-message')->withBody([
                            'phone' => $serializedId,
                            'message' => $messagesToSend,
                            'isGroup' => true
                        ])->withHeaders([
                            'Content-Type' => 'application/json',
                            'Authorization' => 'Bearer ' . $sessionToken->token
                        ])->asJson()->post();

Additional context / Screenshot

image

renat473 commented 1 year ago

An attempt was made to reproduce the problem reported in the current version and the problem was not found.