├── .nvmrc ├── .husky ├── .gitignore ├── pre-commit └── commit-msg ├── .npmrc ├── .prettierignore ├── .lintstagedrc ├── CHANGELOG.md ├── storageState.json ├── .prettierrc ├── .github ├── FUNDING.yml ├── workflows │ ├── commitlint.yml │ ├── lint.yml │ └── build.yml └── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature_request.md │ └── support_question.md ├── .gitignore ├── tests ├── tsconfig.json └── global.d.ts ├── .npmignore ├── .editorconfig ├── .release-it.yml ├── typedoc.json ├── .commitlintrc.json ├── .vscode ├── settings.json └── tasks.json ├── tsconfig.json └── src ├── cart ├── index.ts └── functions │ ├── index.ts │ └── get.ts ├── catalog ├── index.ts └── functions │ └── getMyCatalog.ts ├── community └── index.ts ├── privacy ├── index.ts └── functions │ └── index.ts ├── profile ├── index.ts └── functions │ ├── isBusiness.ts │ ├── getMyProfileName.ts │ ├── setMyProfileName.ts │ └── getMyStatus.ts ├── newsletter ├── index.ts └── functions │ └── index.ts ├── blocklist ├── events │ ├── index.ts │ ├── eventTypes.ts │ └── registerSyncedEvent.ts ├── index.ts ├── types.ts └── functions │ ├── all.ts │ ├── index.ts │ └── isBlocked.ts ├── chat ├── util │ └── index.ts ├── index.ts ├── events │ └── index.ts └── functions │ ├── closeChat.ts │ ├── get.ts │ └── unmute.ts ├── status ├── events │ ├── index.ts │ ├── eventTypes.ts │ └── registerSyncedEvent.ts ├── index.ts ├── functions │ ├── get.ts │ └── getMyStatus.ts └── defaultSendStatusOptions.ts ├── call ├── events │ └── index.ts ├── index.ts └── functions │ └── index.ts ├── order ├── events │ ├── index.ts │ └── eventTypes.ts ├── index.ts └── functions │ └── index.ts ├── group ├── events │ └── index.ts ├── index.ts └── functions │ ├── iAmAdmin.ts │ ├── iAmMember.ts │ ├── iAmSuperAdmin.ts │ ├── iAmRestrictedMember.ts │ ├── getGroupSizeLimit.ts │ ├── getParticipants.ts │ └── leave.ts ├── types.ts ├── contact └── index.ts ├── labels ├── index.ts ├── types.ts └── functions │ └── deleteAllLabels.ts ├── whatsapp ├── contants │ ├── index.ts │ ├── DROP_ATTR.ts │ └── SANITIZED_VERSION_STR.ts ├── multidevice │ └── index.ts ├── types.ts ├── websocket │ ├── index.ts │ ├── generateId.ts │ ├── startWebComms.ts │ ├── ensureE2ESessions.ts │ ├── sendSmaxStanza.ts │ ├── stopComms.ts │ ├── wap.ts │ └── smax.ts ├── functions │ ├── STATUS_JID.ts │ ├── isWid.ts │ ├── getNextLabelId.ts │ ├── isRegistered.ts │ ├── syncABPropsTask.ts │ ├── deleteNewsletter.ts │ ├── randomHex.ts │ ├── isAnimatedWebp.ts │ ├── setPushname.ts │ ├── uploadMedia.ts │ ├── updateCartEnabled.ts │ ├── getGroupSizeLimit.ts │ ├── muteNewsletter.ts │ ├── toUserLid.ts │ ├── getPhoneNumber.ts │ ├── getTableVotes.ts │ ├── canReplyMsg.ts │ ├── encodeMaybeMediaType.ts │ ├── frontendFireAndForget.ts │ ├── unmuteNewsletter.ts │ ├── getOrderInfo.ts │ ├── removeStatusMessage.ts │ ├── updateCart.ts │ ├── initializeAltDeviceLinking.ts │ ├── getAsMms.ts │ ├── getCountryShortcodeByPhone.ts │ ├── statusEnable.ts │ ├── getQuotedMsgObj.ts │ ├── msgDataFromMsgModel.ts │ ├── calculateFilehashFromBlob.ts │ ├── canEditCaption.ts │ ├── getCurrentLid.ts │ ├── shouldHaveAccountLid.ts │ ├── currencyForCountryShortcode.ts │ ├── voteFromDbRow.ts │ ├── createEventCallLink.ts │ ├── genBotMsgSecretFromMsgSecret.ts │ ├── subscribePresence.ts │ ├── selectChatForOneOnOneMessage.ts │ ├── sendDelete.ts │ ├── createOrder.ts │ ├── GROUP_JID.ts │ ├── getABPropConfigValue.ts │ ├── joinGroupViaInvite.ts │ ├── getChatRecordByAccountLid.ts │ ├── getCommunityParticipants.ts │ ├── resetGroupInviteCode.ts │ ├── sendExitGroup.ts │ ├── getExisting.ts │ ├── editBusinessProfile.ts │ ├── queryGroupInviteCode.ts │ ├── getFanOutList.ts │ ├── getMembershipApprovalRequests.ts │ ├── isLidMigrated.ts │ ├── updateMessageTable.ts │ ├── colorIndexToHex.ts │ ├── createNewsletterQuery.ts │ ├── genLinkDeviceCodeForPhoneNumber.ts │ ├── getNumChatsPinned.ts │ ├── isFilterExcludedFromSearchTreatmentInInboxFlow.ts │ ├── sendTextMsgToChat.ts │ ├── typeAttributeFromProtobuf.ts │ ├── uploadProductImage.ts │ ├── findFirstWebLink.ts │ ├── findCommonGroups.ts │ ├── randomId.ts │ ├── canEditMsg.ts │ ├── encryptMsgProtobuf.ts │ ├── createMsgProtobuf.ts │ ├── mediaTypeFromProtobuf.ts │ └── sendReactionToMsg.ts ├── misc │ ├── Socket.ts │ ├── Stream.ts │ ├── Conn.ts │ ├── MediaUtils.ts │ ├── NetworkStatus.ts │ ├── MediaObjectUtil.ts │ ├── Enviroment.ts │ ├── ImageUtils.ts │ └── USyncUser.ts ├── enums │ ├── PIN_STATE.ts │ ├── index.ts │ ├── KIC_ENTRY_POINT_TYP.ts │ └── OUTWARD_TYPES.ts └── index.ts ├── conn ├── index.ts ├── functions │ ├── isMultiDevice.ts │ ├── isAuthenticated.ts │ ├── isIdle.ts │ ├── logout.ts │ ├── isMainInit.ts │ ├── isOnline.ts │ ├── needsUpdate.ts │ ├── changeEnviromentDevice.ts │ ├── isMainLoaded.ts │ ├── getPlatform.ts │ ├── isRegistered.ts │ ├── isMainReady.ts │ ├── getMyUserId.ts │ └── setMultiDevice.ts ├── patch.ts ├── events │ ├── registerLogoutEvent.ts │ ├── registerMainInit.ts │ ├── index.ts │ ├── registerOnlineEvent.ts │ ├── registerMainLoadedEvent.ts │ └── registerNeedsUpdateEvent.ts └── types.ts ├── webpack └── eventTypes.ts ├── util ├── isBase64.ts ├── resizeImage.ts ├── blobToBase64.ts ├── errors.ts ├── blobToArrayBuffer.ts ├── generateOrderUniqueId.ts └── wrapFunction.ts ├── assert ├── index.ts ├── assertIsBusiness.ts └── assertWid.ts ├── config ├── eventTypes.ts └── defaultConfig.ts └── enums.ts /.nvmrc: -------------------------------------------------------------------------------- 1 | 24.12.0 -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | legacy-peer-deps=true 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | html 3 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | npx --no-install lint-staged 2 | -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "*.ts": "eslint --fix" 3 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 3.19.3 (2025-11-26) 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | npx --no-install commitlint --edit $1 2 | -------------------------------------------------------------------------------- /storageState.json: -------------------------------------------------------------------------------- 1 | { 2 | "cookies": [], 3 | "origins": [] 4 | } 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "es5" 4 | } 5 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [icleitoncosta, joaosouz4dev] 2 | open_collective: wppconnect 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.tgz 2 | /.idea 3 | /debug.log 4 | /dist/ 5 | /docs 6 | /media 7 | /node_modules 8 | /userDataDir* 9 | /wa-source 10 | yarn.lock 11 | -------------------------------------------------------------------------------- /tests/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "./" 5 | }, 6 | "include": ["**/*.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.tgz 3 | *.zip 4 | /docs 5 | /src 6 | /tsconfig.json 7 | /typedoc.json 8 | /userDataDir 9 | /wa-source 10 | /webpack.config.js 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | charset = utf-8 7 | 8 | [{package.json}] 9 | indent_style = space 10 | indent_size = 2 11 | -------------------------------------------------------------------------------- /.release-it.yml: -------------------------------------------------------------------------------- 1 | git: 2 | commitMessage: 'chore(release): v${version}' 3 | tagAnnotation: 'chore(release): v${version}' 4 | tagName: 'v${version}' 5 | 6 | hooks: 7 | after:bump: 8 | - 'npm run changelog:update' 9 | 10 | # automatic publish from github workflow 11 | npm: 12 | publish: false 13 | private: true 14 | registry: 'OMITTED' 15 | -------------------------------------------------------------------------------- /typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://typedoc.org/schema.json", 3 | "disableSources": false, 4 | "entryPoints": ["src/index.ts"], 5 | "excludeExternals": false, 6 | "excludePrivate": true, 7 | "excludeProtected": true, 8 | "includeVersion": true, 9 | "out": "docs", 10 | "plugin": ["typedoc-plugin-mdn-links"], 11 | // "theme": "google-tag-manager", 12 | //"gaID": "G-LTZL26963K" 13 | } 14 | -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/commitlintrc.json", 3 | "extends": ["@commitlint/config-conventional"], 4 | "rules": { 5 | "body-max-line-length": [0, "always", 100], 6 | "header-max-length": [2, "always", 120], 7 | "subject-case": [ 8 | 1, 9 | "never", 10 | ["sentence-case", "start-case", "pascal-case", "upper-case"] 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.github/workflows/commitlint.yml: -------------------------------------------------------------------------------- 1 | name: commit lint 2 | on: [pull_request] 3 | 4 | jobs: 5 | commitlint: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: Checkout 9 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 10 | with: 11 | fetch-depth: 0 12 | 13 | - name: Lint commit 14 | uses: wagoid/commitlint-github-action@v6.2.1 15 | with: 16 | configFile: './.commitlintrc.json' 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: 💬 GitHub Discussions 4 | url: https://github.com/wppconnect-team/wa-js/discussions 5 | about: Ask questions and discuss with the community 6 | - name: 📚 Documentation 7 | url: https://wppconnect-team.github.io/wa-js/ 8 | about: Browse the official documentation 9 | - name: 💭 Discord Community 10 | url: https://discord.gg/JU5JGGKGNG 11 | about: Join our Discord server for real-time chat 12 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[javascript]": { 3 | "editor.maxTokenizationLineLength": 2500, 4 | "editor.bracketPairColorization.enabled": false, 5 | "editor.guides.bracketPairs": false, 6 | "editor.stickyScroll.enabled": false 7 | }, 8 | "search.useIgnoreFiles": false, 9 | "search.exclude": { 10 | "**/node_modules": true, 11 | "**/bower_components": true, 12 | "**/dist": true, 13 | "**/docs": true, 14 | "**/userDataDir": true, 15 | "**/wa-source": false 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "esModuleInterop": true, 5 | "experimentalDecorators": true, 6 | "forceConsistentCasingInFileNames": true, 7 | "importHelpers": false, 8 | "module": "CommonJS", 9 | "moduleResolution": "node", 10 | "outDir": "./dist", 11 | "removeComments": false, 12 | "resolveJsonModule": true, 13 | "skipLibCheck": true, 14 | "sourceMap": true, 15 | "strict": true, 16 | "target": "ES2017" 17 | }, 18 | "include": ["src/**/*"], 19 | "exclude": ["src/tools/**/*"] 20 | } 21 | -------------------------------------------------------------------------------- /src/cart/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './functions'; 18 | -------------------------------------------------------------------------------- /src/catalog/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './functions'; 18 | -------------------------------------------------------------------------------- /src/community/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './functions'; 18 | -------------------------------------------------------------------------------- /src/privacy/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './functions/'; 18 | -------------------------------------------------------------------------------- /src/profile/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './functions'; 18 | -------------------------------------------------------------------------------- /src/newsletter/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './functions'; 18 | -------------------------------------------------------------------------------- /src/blocklist/events/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './registerSyncedEvent'; 18 | -------------------------------------------------------------------------------- /src/chat/util/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2025 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './rehydrateMessage'; 18 | -------------------------------------------------------------------------------- /src/status/events/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './registerSyncedEvent'; 18 | -------------------------------------------------------------------------------- /src/call/events/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './registerIncomingCallEvent'; 18 | -------------------------------------------------------------------------------- /src/order/events/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './registerUpdateOrderEvent'; 18 | -------------------------------------------------------------------------------- /src/group/events/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './registerParticipantsChangedEvent'; 18 | -------------------------------------------------------------------------------- /src/call/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './events'; 18 | 19 | export * from './functions'; 20 | -------------------------------------------------------------------------------- /src/types.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export interface Stringable { 18 | toString(): string; 19 | } 20 | -------------------------------------------------------------------------------- /src/blocklist/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './events'; 18 | 19 | export * from './functions'; 20 | -------------------------------------------------------------------------------- /src/contact/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './patch'; 18 | 19 | export * from './functions'; 20 | -------------------------------------------------------------------------------- /src/group/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './events'; 18 | 19 | export * from './functions'; 20 | -------------------------------------------------------------------------------- /src/labels/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './functions'; 18 | export * from './types'; 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: "I have a suggestion (and may want to implement it \U0001F642)!" 4 | labels: 'enhancement, needs triage' 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /src/whatsapp/contants/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './DROP_ATTR'; 18 | export * from './SANITIZED_VERSION_STR'; 19 | -------------------------------------------------------------------------------- /src/order/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './events'; 18 | export * from './functions'; 19 | export * from './types'; 20 | -------------------------------------------------------------------------------- /src/status/events/eventTypes.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export interface StatusEventTypes { 18 | 'status.sync': undefined; 19 | } 20 | -------------------------------------------------------------------------------- /src/blocklist/events/eventTypes.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export interface BlocklistEventTypes { 18 | 'blocklist.sync': undefined; 19 | } 20 | -------------------------------------------------------------------------------- /src/conn/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './events'; 18 | import './patch'; 19 | 20 | export * from './functions'; 21 | export * from './types'; 22 | -------------------------------------------------------------------------------- /src/whatsapp/multidevice/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './adv'; 18 | export * from './waNoiseInfo'; 19 | export * from './waSignalStore'; 20 | -------------------------------------------------------------------------------- /src/status/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './events'; 18 | import './patch'; 19 | 20 | export * from './defaultSendStatusOptions'; 21 | export * from './functions'; 22 | -------------------------------------------------------------------------------- /src/blocklist/types.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '../whatsapp'; 18 | 19 | export interface BlocklistResult { 20 | wid: Wid; 21 | isBlocked: boolean; 22 | } 23 | -------------------------------------------------------------------------------- /src/conn/functions/isMultiDevice.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export function isMultiDevice(): boolean { 18 | /** 19 | * always true for >= 2.2241.6 20 | */ 21 | return true; 22 | } 23 | -------------------------------------------------------------------------------- /src/webpack/eventTypes.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export interface WebpackEvents { 18 | 'webpack.injected': void; 19 | 'webpack.ready': void; 20 | 'webpack.full_ready': void; 21 | } 22 | -------------------------------------------------------------------------------- /src/order/functions/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { accept } from './accept'; 18 | export { decline } from './decline'; 19 | export { get } from './get'; 20 | export { update } from './update'; 21 | -------------------------------------------------------------------------------- /tests/global.d.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import type * as wajs from '../dist'; 18 | 19 | declare global { 20 | interface Window { 21 | WPP: typeof wajs; 22 | } 23 | const WPP: typeof wajs; 24 | } 25 | -------------------------------------------------------------------------------- /src/call/functions/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { accept } from './accept'; 18 | export { end } from './end'; 19 | export { offer } from './offer'; 20 | export { reject, reject as rejectCall } from './reject'; 21 | -------------------------------------------------------------------------------- /src/labels/types.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export interface Label { 18 | id: string; 19 | name: string; 20 | color: number | null; 21 | count: number; 22 | hexColor: string; 23 | colorIndex: number; 24 | } 25 | -------------------------------------------------------------------------------- /src/util/isBase64.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const re = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/; 18 | 19 | export function isBase64(data: string): boolean { 20 | return re.test(data); 21 | } 22 | -------------------------------------------------------------------------------- /src/assert/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './assertChat'; 18 | export * from './assertColor'; 19 | export * from './assertIsBusiness'; 20 | export * from './assertProduct'; 21 | export * from './assertWid'; 22 | -------------------------------------------------------------------------------- /src/blocklist/functions/all.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { BlocklistStore, Wid } from '../../whatsapp'; 18 | 19 | export function all(): Wid[] { 20 | return BlocklistStore.getModelsArray().map((b) => b.id); 21 | } 22 | -------------------------------------------------------------------------------- /src/conn/functions/isAuthenticated.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import * as wa_functions from '../../whatsapp/functions'; 18 | 19 | export function isAuthenticated(): boolean { 20 | return wa_functions.isAuthenticated(); 21 | } 22 | -------------------------------------------------------------------------------- /src/chat/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './events'; 18 | import './patch'; 19 | 20 | export * from './defaultSendMessageOptions'; 21 | export * from './functions'; 22 | export * from './types'; 23 | export * from './util'; 24 | -------------------------------------------------------------------------------- /src/whatsapp/types.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { SendMsgResult } from './enums'; 18 | 19 | export interface SendMsgResultObject { 20 | messageSendResult: SendMsgResult; 21 | t?: number; 22 | count?: number | null; 23 | } 24 | -------------------------------------------------------------------------------- /src/blocklist/functions/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { all } from './all'; 18 | export { blockContact } from './blockContact'; 19 | export { isBlocked } from './isBlocked'; 20 | export { unblockContact } from './unblockContact'; 21 | -------------------------------------------------------------------------------- /src/newsletter/functions/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { create } from './create'; 18 | export { destroy } from './destroy'; 19 | export { edit } from './edit'; 20 | export { getSubscribers } from './getSubscribers'; 21 | export { mute } from './mute'; 22 | -------------------------------------------------------------------------------- /src/conn/functions/isIdle.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Socket } from '../../whatsapp'; 18 | import { SOCKET_STATE } from '../../whatsapp/enums/SOCKET_STATE'; 19 | 20 | export function isIdle(): boolean { 21 | return Socket.state === SOCKET_STATE.UNPAIRED_IDLE; 22 | } 23 | -------------------------------------------------------------------------------- /src/conn/functions/logout.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Cmd, Socket } from '../../whatsapp'; 18 | 19 | export async function logout(): Promise { 20 | Socket.logout(); 21 | 22 | await new Promise((resolve) => { 23 | Cmd.once('logout', resolve); 24 | }); 25 | 26 | return true; 27 | } 28 | -------------------------------------------------------------------------------- /src/group/functions/iAmAdmin.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '../../whatsapp'; 18 | import { ensureGroup } from './'; 19 | 20 | export async function iAmAdmin(groupId: string | Wid) { 21 | const groupChat = await ensureGroup(groupId); 22 | return groupChat.groupMetadata!.participants.iAmAdmin(); 23 | } 24 | -------------------------------------------------------------------------------- /src/config/eventTypes.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Config } from './Config'; 18 | 19 | export interface ConfigEventTypes { 20 | 'config.update': { 21 | config: Config; 22 | key: string | number | symbol; 23 | path: (string | number | symbol)[]; 24 | target: any; 25 | value: any; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /src/group/functions/iAmMember.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '../../whatsapp'; 18 | import { ensureGroup } from './'; 19 | 20 | export async function iAmMember(groupId: string | Wid) { 21 | const groupChat = await ensureGroup(groupId); 22 | return groupChat.groupMetadata!.participants.iAmMember(); 23 | } 24 | -------------------------------------------------------------------------------- /src/whatsapp/contants/DROP_ATTR.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 831914 21 | */ 22 | export declare const DROP_ATTR: any; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | DROP_ATTR: ['DROP_ATTR'], 28 | }, 29 | (m) => m.DROP_ATTR 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/websocket/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './ensureE2ESessions'; 18 | export * from './generateId'; 19 | export * from './sendSmaxStanza'; 20 | export * from './smax'; 21 | export * from './startWebComms'; 22 | export * from './stopComms'; 23 | export * from './wap'; 24 | export * from './WapNode'; 25 | -------------------------------------------------------------------------------- /src/cart/functions/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { add } from './add'; 18 | export { clear } from './clear'; 19 | export { get } from './get'; 20 | export { getThumbFromCart } from './getThumbFromCart'; 21 | export { remove } from './remove'; 22 | export { submit } from './submit'; 23 | export { update } from './update'; 24 | -------------------------------------------------------------------------------- /src/conn/functions/isMainInit.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Check is main interface is initializing 19 | * 20 | * @example 21 | * ```javascript 22 | * const isMainInit = WPP.conn.isMainInit(); 23 | * ``` 24 | */ 25 | export function isMainInit(): boolean { 26 | return Boolean((window as any).Debug?.VERSION); 27 | } 28 | -------------------------------------------------------------------------------- /src/group/functions/iAmSuperAdmin.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '../../whatsapp'; 18 | import { ensureGroup } from './'; 19 | 20 | export async function iAmSuperAdmin(groupId: string | Wid) { 21 | const groupChat = await ensureGroup(groupId); 22 | return groupChat.groupMetadata!.participants.iAmMember(); 23 | } 24 | -------------------------------------------------------------------------------- /src/status/functions/get.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { assertWid } from '../../assert'; 18 | import { StatusV3Model, StatusV3Store, Wid } from '../../whatsapp'; 19 | 20 | export function get(chatId: string | Wid): StatusV3Model | undefined { 21 | const wid = assertWid(chatId); 22 | return StatusV3Store.get(wid); 23 | } 24 | -------------------------------------------------------------------------------- /src/whatsapp/functions/STATUS_JID.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp WAJids 21 | */ 22 | export declare const STATUS_JID: string; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | STATUS_JID: 'STATUS_JID', 28 | }, 29 | (m) => m.STATUS_JID 30 | ); 31 | -------------------------------------------------------------------------------- /src/conn/functions/isOnline.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { NetworkStatus } from '../../whatsapp'; 18 | 19 | /** 20 | * Check is online 21 | * 22 | * @example 23 | * ```javascript 24 | * const isOnline = WPP.conn.isOnline(); 25 | * ``` 26 | */ 27 | export function isOnline(): boolean { 28 | return NetworkStatus.online; 29 | } 30 | -------------------------------------------------------------------------------- /src/whatsapp/functions/isWid.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 469475 21 | */ 22 | export declare function isWid(number: string): boolean; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | isWid: 'default.isWid', 28 | }, 29 | (m) => m.default.isWid 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/misc/Socket.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { SocketModel } from '../models'; 19 | 20 | /** @whatsapp 65044 21 | * @whatsapp 765044 >= 2.2222.8 22 | */ 23 | export declare const Socket: SocketModel; 24 | 25 | exportModule(exports, { Socket: 'Socket' }, (m) => m.Socket); 26 | -------------------------------------------------------------------------------- /src/whatsapp/misc/Stream.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { StreamModel } from '../models'; 19 | 20 | /** @whatsapp 8080 21 | * @whatsapp 608080 >= 2.2222.8 22 | */ 23 | export declare const Stream: StreamModel; 24 | 25 | exportModule(exports, { Stream: 'Stream' }, (m) => m.Stream); 26 | -------------------------------------------------------------------------------- /src/whatsapp/websocket/generateId.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 504784 >= 2.2301.6 21 | */ 22 | export declare function generateId(): string; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | generateId: 'generateId', 28 | }, 29 | (m) => m.generateId 30 | ); 31 | -------------------------------------------------------------------------------- /src/conn/patch.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import * as webpack from '../webpack'; 18 | import { IsOfficialClient } from '../whatsapp'; 19 | 20 | webpack.onInjected(() => { 21 | /** 22 | * When sending logs to the WhatsApp server, it will always report that the ocVersion is true. 23 | */ 24 | IsOfficialClient.isOfficialClient = true; 25 | }); 26 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getNextLabelId.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** @whatsapp 263133 20 | */ 21 | export declare function getNextLabelId(): Promise; 22 | exportModule( 23 | exports, 24 | { 25 | getNextLabelId: 'getNextLabelId', 26 | }, 27 | (m) => m.getNextLabelId 28 | ); 29 | -------------------------------------------------------------------------------- /src/whatsapp/functions/isRegistered.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 673168 21 | */ 22 | export declare function isRegistered(): boolean; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | isRegistered: ['isRegistered'], 28 | }, 29 | (m) => m.isRegistered 30 | ); 31 | -------------------------------------------------------------------------------- /src/group/functions/iAmRestrictedMember.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '../../whatsapp'; 18 | import { ensureGroup } from './'; 19 | 20 | export async function iAmRestrictedMember(groupId: string | Wid) { 21 | const groupChat = await ensureGroup(groupId); 22 | return groupChat.groupMetadata!.participants.iAmRestrictedMember(); 23 | } 24 | -------------------------------------------------------------------------------- /src/whatsapp/websocket/startWebComms.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 504784 21 | */ 22 | export declare function startWebComms(): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | startWebComms: 'startWebComms', 28 | }, 29 | (m) => m.startWebComms 30 | ); 31 | -------------------------------------------------------------------------------- /src/blocklist/functions/isBlocked.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { assertWid } from '../../assert'; 18 | import { BlocklistStore, Wid } from '../../whatsapp'; 19 | 20 | export function isBlocked(chatId: string | Wid): boolean { 21 | const wid = assertWid(chatId); 22 | 23 | const contact = BlocklistStore.get(wid); 24 | 25 | return !!contact; 26 | } 27 | -------------------------------------------------------------------------------- /src/conn/events/registerLogoutEvent.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { internalEv } from '../../eventEmitter'; 18 | import * as webpack from '../../webpack'; 19 | import { Cmd } from '../../whatsapp'; 20 | 21 | webpack.onInjected(registerLogoutEvent); 22 | 23 | function registerLogoutEvent() { 24 | Cmd.on('logout', () => internalEv.emit('conn.logout')); 25 | } 26 | -------------------------------------------------------------------------------- /src/whatsapp/functions/syncABPropsTask.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 266485 21 | */ 22 | export declare function syncABPropsTask(): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | syncABPropsTask: 'syncABPropsTask', 28 | }, 29 | (m) => m.syncABPropsTask 30 | ); 31 | -------------------------------------------------------------------------------- /src/conn/functions/needsUpdate.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Stream } from '../../whatsapp'; 18 | 19 | /** 20 | * Check if whatsapp web is asking for update 21 | * 22 | * @example 23 | * ```javascript 24 | * const needsUpdate = WPP.conn.needsUpdate(); 25 | * ``` 26 | */ 27 | export function needsUpdate(): boolean { 28 | return Stream.needsUpdate; 29 | } 30 | -------------------------------------------------------------------------------- /src/whatsapp/functions/deleteNewsletter.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 698436 21 | */ 22 | export declare function deleteNewsletter(id: string): any; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | deleteNewsletter: 'deleteNewsletter', 28 | }, 29 | (m) => m.deleteNewsletter 30 | ); 31 | -------------------------------------------------------------------------------- /src/status/defaultSendStatusOptions.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { SendStatusOptions } from './functions/sendRawStatus'; 18 | import { TextStatusOptions } from './functions/sendTextStatus'; 19 | 20 | export type AllStatusOptions = SendStatusOptions & TextStatusOptions; 21 | 22 | export const defaultSendStatusOptions: AllStatusOptions = { 23 | waitForAck: true, 24 | }; 25 | -------------------------------------------------------------------------------- /src/whatsapp/functions/randomHex.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 832678 21 | * @whatsapp 787614 >= 2.2228.4 22 | */ 23 | export declare function randomHex(size: number): string; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | randomHex: 'randomHex', 29 | }, 30 | (m) => m.randomHex 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/misc/Conn.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { ConnModel } from '../models'; 19 | 20 | /** @whatsapp 17239 21 | * @whatsapp 317239 >= 2.2222.8 22 | */ 23 | export declare const Conn: ConnModel; 24 | 25 | exportModule( 26 | exports, 27 | { Conn: 'Conn' }, 28 | (m) => (m.Conn && m.ConnImpl) || m.Conn 29 | ); 30 | -------------------------------------------------------------------------------- /src/profile/functions/isBusiness.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Conn } from '../../whatsapp'; 18 | 19 | /** 20 | * Return the current logged user is Bussiness or not 21 | * 22 | * @example 23 | * ```javascript 24 | * WPP.profile.isBusiness(); 25 | * ``` 26 | * @category Profile 27 | */ 28 | export function isBusiness(): boolean | undefined { 29 | return Conn.isSMB; 30 | } 31 | -------------------------------------------------------------------------------- /src/whatsapp/contants/SANITIZED_VERSION_STR.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 831914 21 | */ 22 | export declare const SANITIZED_VERSION_STR: string; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | SANITIZED_VERSION_STR: ['SANITIZED_VERSION_STR'], 28 | }, 29 | (m) => m.SANITIZED_VERSION_STR 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/isAnimatedWebp.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 176819 >= 2.2242.6 21 | */ 22 | export declare function isAnimatedWebp(data: ArrayBuffer): boolean; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | isAnimatedWebp: 'isAnimatedWebp', 28 | }, 29 | (m) => m.isAnimatedWebp 30 | ); 31 | -------------------------------------------------------------------------------- /src/conn/functions/changeEnviromentDevice.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Enviroment } from '../../whatsapp'; 18 | 19 | /** 20 | * Change the current environment device between Web and Windows. 21 | */ 22 | export function changeEnviromentDevice() { 23 | Enviroment.default.isWeb = !Enviroment.default.isWeb; 24 | Enviroment.default.isWindows = !Enviroment.default.isWindows; 25 | } 26 | -------------------------------------------------------------------------------- /src/conn/functions/isMainLoaded.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Cmd } from '../../whatsapp'; 18 | 19 | /** 20 | * Check is main interface is authenticated and loaded, bot not synced 21 | * 22 | * @example 23 | * ```javascript 24 | * const isMainLoaded = WPP.conn.isMainLoaded(); 25 | * ``` 26 | */ 27 | export function isMainLoaded(): boolean { 28 | return Cmd.isMainLoaded; 29 | } 30 | -------------------------------------------------------------------------------- /src/enums.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export enum TextFontStyle { 18 | SANS_SERIF = 0, 19 | SERIF = 1, 20 | NORICAN_REGULAR = 2, 21 | BRYNDAN_WRITE = 3, 22 | BEBASNEUE_REGULAR = 4, 23 | OSWALD_HEAVY = 5, 24 | } 25 | 26 | export enum PrivacyDisallowedListType { 27 | About = 'status', 28 | GroupAdd = 'groupadd', 29 | LastSeen = 'last', 30 | ProfilePicture = 'profile', 31 | } 32 | -------------------------------------------------------------------------------- /src/whatsapp/functions/setPushname.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 135963 >= 2.2310.5 21 | */ 22 | export declare function setPushname(name: string): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | setPushname: 'setPushname', 28 | }, 29 | (m) => m.setPushname && !m.setBrowserId 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/uploadMedia.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { ChatModel } from '..'; 18 | import { exportModule } from '../exportModule'; 19 | 20 | /** @whatsapp 709089 21 | */ 22 | export declare function uploadMedia(chat: ChatModel): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | uploadMedia: 'uploadMedia', 28 | }, 29 | (m) => m.uploadMedia 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/misc/MediaUtils.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** @whatsapp 56406 20 | * @whatsapp 756406 >= 2.2222.8 21 | */ 22 | export declare namespace MediaUtils { 23 | function getImageWidthHeight(): Promise<{ width: number; height: number }>; 24 | } 25 | 26 | exportModule(exports, 'MediaUtils', (m) => m.getImageWidthHeight); 27 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "npm", 6 | "script": "watch", 7 | "group": "build", 8 | "isBackground": true, 9 | "problemMatcher": { 10 | "owner": "Webpack (Dev, Continuous)", 11 | "severity": "error", 12 | "fileLocation": "absolute", 13 | "source": "webpack-typescript", 14 | "background": { 15 | "activeOnStart": true, 16 | "beginsPattern": ".", 17 | "endsPattern": "webpack [\\d.]+ compiled" 18 | }, 19 | "pattern": [ 20 | { 21 | "regexp": "ERROR in ([^\\(]*)\\((\\d+),(\\d+)\\)", 22 | "file": 1, 23 | "line": 2, 24 | "column": 3 25 | }, 26 | { 27 | "regexp": "([A-Za-z0-9-]+):(.*)", 28 | "message": 2, 29 | "code": 1 30 | } 31 | ] 32 | }, 33 | "label": "npm: watch", 34 | "detail": "webpack watch" 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /src/conn/functions/getPlatform.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Conn } from '../../whatsapp'; 18 | 19 | /** 20 | * Check what's device platform is connected 21 | * @returns android | iphone | wp 22 | * 23 | * @example 24 | * ```javascript 25 | * const getPlatform = WPP.conn.getPlatform(); 26 | * ``` 27 | */ 28 | export function getPlatform(): any { 29 | return Conn.platform; 30 | } 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/updateCartEnabled.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 990553 21 | */ 22 | export declare function updateCartEnabled(enabled: boolean): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | updateCartEnabled: 'updateCartEnabled', 28 | }, 29 | (m) => m.updateCartEnabled 30 | ); 31 | -------------------------------------------------------------------------------- /src/labels/functions/deleteAllLabels.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { assertIsBusiness } from '../../assert'; 18 | import { deleteLabel, DeleteLabelReturn, getAllLabels } from '.'; 19 | 20 | export async function deleteAllLabels(): Promise { 21 | assertIsBusiness(); 22 | 23 | const labels = await getAllLabels(); 24 | return deleteLabel(labels.map((e) => e.id)); 25 | } 26 | -------------------------------------------------------------------------------- /src/util/resizeImage.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import Compressor from 'compressorjs'; 18 | 19 | export function resizeImage( 20 | blob: Blob, 21 | options: Compressor.Options = {} 22 | ): Promise { 23 | return new Promise((success, error) => { 24 | new Compressor(blob, { 25 | ...options, 26 | success, 27 | error, 28 | }); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /src/whatsapp/enums/PIN_STATE.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** @whatsapp WAWebPinMsgConstants >= 2.3000.1012170943 20 | */ 21 | export declare enum PIN_STATE { 22 | INVALID = 0, 23 | PIN = 1, 24 | UNPIN = 2, 25 | } 26 | 27 | exportModule( 28 | exports, 29 | { 30 | PIN_STATE: 'PIN_STATE', 31 | }, 32 | (m) => m.PIN_STATE 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getGroupSizeLimit.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 97858 >= 2.2304.7 21 | */ 22 | export declare function getGroupSizeLimit(groupType?: string): number; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | getGroupSizeLimit: 'getGroupSizeLimit', 28 | }, 29 | (m) => m.getGroupSizeLimit 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/muteNewsletter.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 736062 21 | */ 22 | export declare function muteNewsletter( 23 | newsletterIds: string[] 24 | ): Promise; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | muteNewsletter: 'muteNewsletter', 30 | }, 31 | (m) => m.muteNewsletter 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/functions/toUserLid.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** 21 | * @whatsapp WAWebLidMigrationUtils >= 2.3000.x 22 | */ 23 | export declare function toUserLid(wid: Wid): Wid; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | toUserLid: ['toUserLid'], 29 | }, 30 | (m) => m.toUserLid 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getPhoneNumber.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** 21 | * @whatsapp WAWebApiContact 22 | */ 23 | export declare function getPhoneNumber(wid: Wid): any; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | getPhoneNumber: 'getPhoneNumber', 29 | }, 30 | (m) => m.getPhoneNumber 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getTableVotes.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp WAWebPollsVotesSchema => 2.3000.x 21 | */ 22 | export declare function getTableVotes(args?: any): any; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | getTableVotes: ['getTable'], 28 | }, 29 | (m) => m.getTable.toString().includes('poll') 30 | ); 31 | -------------------------------------------------------------------------------- /src/cart/functions/get.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Get products in cart chat 19 | * 20 | * @example 21 | * ```javascript 22 | * const cart = WPP.cart.get('[number]@c.us'); 23 | * ``` 24 | * 25 | * @category Cart 26 | */ 27 | 28 | import { CartModel, CartStore } from '../../whatsapp'; 29 | 30 | export function get(wid: string): CartModel | undefined { 31 | return CartStore.get(wid); 32 | } 33 | -------------------------------------------------------------------------------- /src/conn/functions/isRegistered.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import * as wa_functions from '../../whatsapp/functions'; 18 | 19 | /** 20 | * Check is the current browser is logged before loading 21 | * 22 | * @example 23 | * ```javascript 24 | * const isRegistered = WPP.conn.isRegistered(); 25 | * ``` 26 | */ 27 | export function isRegistered(): boolean { 28 | return wa_functions.isRegistered(); 29 | } 30 | -------------------------------------------------------------------------------- /src/whatsapp/functions/canReplyMsg.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MsgModel } from '../models'; 19 | 20 | /** 21 | * @whatsapp 973480 >= 2.2241.6 22 | */ 23 | export declare function canReplyMsg(msg: MsgModel): boolean; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | canReplyMsg: 'canReplyMsg', 29 | }, 30 | (m) => m.canReplyMsg 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/functions/encodeMaybeMediaType.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 760210 21 | */ 22 | export declare function encodeMaybeMediaType(type: string): string | undefined; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | encodeMaybeMediaType: 'encodeMaybeMediaType', 28 | }, 29 | (m) => m.encodeMaybeMediaType 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/frontendFireAndForget.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 359987 21 | */ 22 | export declare function frontendFireAndForget(e: any, t: any): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | frontendFireAndForget: 'frontendFireAndForget', 28 | }, 29 | (m) => m.frontendFireAndForget 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/unmuteNewsletter.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 639735 21 | */ 22 | export declare function unmuteNewsletter( 23 | newsletterIds: string[] 24 | ): Promise; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | unmuteNewsletter: 'unmuteNewsletter', 30 | }, 31 | (m) => m.unmuteNewsletter 32 | ); 33 | -------------------------------------------------------------------------------- /src/profile/functions/getMyProfileName.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { functions } from '../../whatsapp'; 18 | 19 | /** 20 | * Get your current profile name 21 | * 22 | * @example 23 | * ```javascript 24 | * const myProfileName = WPP.profile.getMyProfileName(); 25 | * ``` 26 | * 27 | * @category Profile 28 | */ 29 | 30 | export function getMyProfileName() { 31 | return functions.getPushname(); 32 | } 33 | -------------------------------------------------------------------------------- /src/status/events/registerSyncedEvent.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { internalEv } from '../../eventEmitter'; 18 | import * as webpack from '../../webpack'; 19 | import { StatusV3Store } from '../../whatsapp'; 20 | 21 | webpack.onInjected(() => registerSyncedEvent()); 22 | 23 | function registerSyncedEvent() { 24 | StatusV3Store.on('sync', () => { 25 | internalEv.emit('status.sync'); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getOrderInfo.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MsgModel } from '../models'; 19 | 20 | /** 21 | * @whatsapp 706197 => 2.2335.9 22 | */ 23 | export declare function getOrderInfo(msg: MsgModel): boolean; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | getOrderInfo: 'getOrderInfo', 29 | }, 30 | (m) => m.getOrderInfo 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/functions/removeStatusMessage.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp WAWebDBMessageDelete 21 | */ 22 | export declare function removeStatusMessage(id: string[]): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | removeStatusMessage: ['removeStatusMessage'], 28 | }, 29 | (m) => m.removeStatusMessage 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/updateCart.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { CartModel } from '../models'; 19 | 20 | /** 21 | * @whatsapp 990553 22 | */ 23 | export declare function updateCart(cart: CartModel, c?: number): Promise; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | updateCart: 'updateCart', 29 | }, 30 | (m) => m.updateCart 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/misc/NetworkStatus.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { NetworkStatusModel } from '../models'; 19 | 20 | /** 21 | * @whatsapp 765044 >= 2.2222.8 22 | */ 23 | export declare const NetworkStatus: NetworkStatusModel; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | NetworkStatus: 'default', 29 | }, 30 | (m) => m.default.checkOnline 31 | ); 32 | -------------------------------------------------------------------------------- /src/blocklist/events/registerSyncedEvent.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { internalEv } from '../../eventEmitter'; 18 | import * as webpack from '../../webpack'; 19 | import { BlocklistStore } from '../../whatsapp'; 20 | 21 | webpack.onInjected(() => registerSyncedEvent()); 22 | 23 | function registerSyncedEvent() { 24 | BlocklistStore.on('sort', () => { 25 | internalEv.emit('blocklist.sync'); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /src/util/blobToBase64.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export function blobToBase64(blob: Blob): Promise { 18 | return new Promise((resolve, reject) => { 19 | const reader = new FileReader(); 20 | reader.onloadend = function () { 21 | resolve(reader.result as string); 22 | }; 23 | reader.onabort = reject; 24 | reader.onerror = reject; 25 | reader.readAsDataURL(blob); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /src/whatsapp/enums/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './ACK'; 18 | export * from './CALL_STATES'; 19 | export * from './GROUP_SETTING_TYPE'; 20 | export * from './KIC_ENTRY_POINT_TYP'; 21 | export * from './LogoutReason'; 22 | export * from './MSG_TYPE'; 23 | export * from './OUTWARD_TYPES'; 24 | export * from './PIN_STATE'; 25 | export * from './PinExpiryDurationOption'; 26 | export * from './SendMsgResult'; 27 | -------------------------------------------------------------------------------- /src/whatsapp/functions/initializeAltDeviceLinking.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 518043 21 | */ 22 | export declare function initializeAltDeviceLinking(): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | initializeAltDeviceLinking: 'initializeAltDeviceLinking', 28 | }, 29 | (m) => m.initializeAltDeviceLinking 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getAsMms.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MsgModel } from '../models'; 19 | 20 | /** 21 | * @whatsapp 163755 >= 2.2318.11 22 | */ 23 | export declare function getAsMms(msg: MsgModel): boolean; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | getAsMms: 'getAsMms', // >= 2.2310.4 29 | }, 30 | (m) => m.getAsMms // >= 2.2310.4 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getCountryShortcodeByPhone.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 755707 21 | */ 22 | export declare function getCountryShortcodeByPhone(params: any): any; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | getCountryShortcodeByPhone: ['getCountryShortcodeByPhone'], 28 | }, 29 | (m) => m.getCountryShortcodeByPhone 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/statusEnable.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp WAWebStatusSendGatingUtils >= 2.3000.0 21 | */ 22 | export declare function primaryFeatureEnabled(key: string): boolean; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | primaryFeatureEnabled: 'primaryFeatureEnabled', 28 | }, 29 | (m) => m.primaryFeatureEnabled 30 | ); 31 | -------------------------------------------------------------------------------- /src/config/defaultConfig.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Config } from './Config'; 18 | 19 | export const defaultConfig: Config = { 20 | deviceName: false, 21 | liveLocationLimit: 10, 22 | disableGoogleAnalytics: false, 23 | googleAnalyticsId: null, 24 | googleAnalyticsUserProperty: {}, 25 | linkPreviewApiServers: null, 26 | poweredBy: 'WA-JS', 27 | sendStatusToDevice: false, 28 | syncAllStatus: true, 29 | }; 30 | -------------------------------------------------------------------------------- /src/util/errors.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export class WPPError extends Error { 18 | constructor( 19 | readonly code: string, 20 | message: string, 21 | extra: { [key: string]: any } = {} 22 | ) { 23 | super(message); 24 | 25 | if (extra) { 26 | const keys = Object.keys(extra); 27 | for (const key of keys) { 28 | (this as any)[key] = extra[key]; 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getQuotedMsgObj.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MsgModel } from '../models'; 19 | 20 | /** 21 | * @whatsapp 697180 >= 2.2245.8 22 | */ 23 | export declare function getQuotedMsgObj(msg: MsgModel): MsgModel; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | getQuotedMsgObj: 'getQuotedMsgObj', 29 | }, 30 | (m) => m.getQuotedMsgObj 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/misc/MediaObjectUtil.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MediaObject } from '.'; 19 | 20 | /** @whatsapp 88297 21 | * @whatsapp 988297 >= 2.2222.8 22 | */ 23 | export declare namespace MediaObjectUtil { 24 | function getOrCreateMediaObject(hash: string): MediaObject; 25 | } 26 | 27 | exportModule(exports, 'MediaObjectUtil', (m) => m.getOrCreateMediaObject); 28 | -------------------------------------------------------------------------------- /src/whatsapp/functions/msgDataFromMsgModel.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MsgModel } from '../models'; 19 | 20 | /** @whatsapp 678794 21 | */ 22 | export declare function msgDataFromMsgModel(msg: MsgModel): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | msgDataFromMsgModel: 'msgDataFromMsgModel', 28 | }, 29 | (m) => m.msgDataFromMsgModel 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/websocket/ensureE2ESessions.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** 21 | * @whatsapp 917504 >= 2.2301.6 22 | */ 23 | export declare function ensureE2ESessions(wid: Wid[]): Promise; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | ensureE2ESessions: 'ensureE2ESessions', 29 | }, 30 | (m) => m.ensureE2ESessions 31 | ); 32 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: lint 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | pull_request: 8 | branches: 9 | - '*' 10 | 11 | jobs: 12 | lint: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 17 | 18 | - name: Setup Node 19 | uses: actions/setup-node@v6.1.0 20 | with: 21 | node-version: 19.x 22 | 23 | - name: Get npm cache directory 24 | id: npm-cache 25 | run: | 26 | echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT 27 | - name: Setup npm cache 28 | uses: actions/cache@v4 29 | with: 30 | path: ${{ steps.npm-cache.outputs.dir }} 31 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 32 | restore-keys: | 33 | ${{ runner.os }}-node- 34 | 35 | - name: Install Dependencies 36 | run: npm ci || npm install 37 | 38 | - name: Lint source 39 | run: npm run lint 40 | -------------------------------------------------------------------------------- /src/util/blobToArrayBuffer.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export function blobToArrayBuffer(blob: Blob): Promise { 18 | return new Promise((resolve, reject) => { 19 | const reader = new FileReader(); 20 | reader.onloadend = function () { 21 | resolve(reader.result as ArrayBuffer); 22 | }; 23 | reader.onabort = reject; 24 | reader.onerror = reject; 25 | reader.readAsArrayBuffer(blob); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /src/whatsapp/functions/calculateFilehashFromBlob.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 818309 >= 2.2228.14 21 | */ 22 | export declare function calculateFilehashFromBlob(file: Blob): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | calculateFilehashFromBlob: 'calculateFilehashFromBlob', 28 | }, 29 | (m) => m.calculateFilehashFromBlob 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/canEditCaption.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MsgModel } from '../models'; 19 | 20 | /** 21 | * @whatsapp WAWebMsgActionCapability >= 2.3000.0 22 | */ 23 | export declare function canEditCaption(msg: MsgModel): boolean; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | canEditCaption: 'canEditCaption', 29 | }, 30 | (m) => m.canEditCaption 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getCurrentLid.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** 21 | * @whatsapp 469475 >= 2.2307.10 22 | * @whatsapp 12643 >= 2.2322.15 23 | */ 24 | export declare function getCurrentLid(wid: Wid): Wid; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | getCurrentLid: 'getCurrentLid', 30 | }, 31 | (m) => m.getCurrentLid 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/functions/shouldHaveAccountLid.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp WAWebLidMigrationUtils >= 2.3000.x 21 | */ 22 | export declare function shouldHaveAccountLid(): boolean; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | shouldHaveAccountLid: ['shouldHaveAccountLid'], 28 | }, 29 | (m) => typeof m.shouldHaveAccountLid === 'function' 30 | ); 31 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | pull_request: 8 | branches: 9 | - '*' 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 17 | 18 | - name: Setup Node 19 | uses: actions/setup-node@v6.1.0 20 | with: 21 | node-version: 19.x 22 | 23 | - name: Get npm cache directory 24 | id: npm-cache 25 | run: | 26 | echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT 27 | - name: Setup npm cache 28 | uses: actions/cache@v4 29 | with: 30 | path: ${{ steps.npm-cache.outputs.dir }} 31 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 32 | restore-keys: | 33 | ${{ runner.os }}-node- 34 | 35 | - name: Install Dependencies 36 | run: npm ci || npm install 37 | 38 | - name: Build source 39 | run: npm run build:prd 40 | -------------------------------------------------------------------------------- /src/assert/assertIsBusiness.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { WPPError } from '../util'; 18 | import { Conn } from '../whatsapp'; 19 | 20 | export class NotIsBusinessError extends WPPError { 21 | constructor() { 22 | super('is_not_business', `This account is not a business version`); 23 | } 24 | } 25 | 26 | export function assertIsBusiness(): void { 27 | if (!Conn.isSMB) { 28 | throw new NotIsBusinessError(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/currencyForCountryShortcode.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 755707 >= 2.2307.10 21 | */ 22 | export declare function currencyForCountryShortcode(params: any): any; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | currencyForCountryShortcode: ['currencyForCountryShortcode'], 28 | }, 29 | (m) => m.currencyForCountryShortcode 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/voteFromDbRow.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MsgModel } from '../models'; 19 | 20 | /** 21 | * @whatsapp WAWebPollsDbSerialization >= 2.3000.x 22 | */ 23 | export declare function voteFromDbRow(msg: MsgModel): Promise; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | voteFromDbRow: ['voteFromDbRow'], 29 | }, 30 | (m) => m.voteFromDbRow 31 | ); 32 | -------------------------------------------------------------------------------- /src/status/functions/getMyStatus.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { getMyUserWid } from '../../conn/functions/getMyUserWid'; 18 | import { StatusV3Model, StatusV3Store } from '../../whatsapp'; 19 | 20 | export async function getMyStatus(): Promise { 21 | let myStatus = StatusV3Store.getMyStatus(); 22 | 23 | if (!myStatus) { 24 | myStatus = await StatusV3Store.find(getMyUserWid()); 25 | } 26 | 27 | return myStatus; 28 | } 29 | -------------------------------------------------------------------------------- /src/whatsapp/functions/createEventCallLink.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** @whatsapp 75887 20 | */ 21 | export declare function createEventCallLink( 22 | eventStartTime: number, 23 | type: 'voice' | 'video' 24 | ): Promise; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | createEventCallLink: 'createEventCallLink', 30 | }, 31 | (m) => m.createEventCallLink 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/functions/genBotMsgSecretFromMsgSecret.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp WAWebBotMessageSecret 21 | */ 22 | export declare function genBotMsgSecretFromMsgSecret(a: any): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | genBotMsgSecretFromMsgSecret: 'genBotMsgSecretFromMsgSecret', 28 | }, 29 | (m) => m.genBotMsgSecretFromMsgSecret 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/subscribePresence.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '..'; 18 | import { exportModule } from '../exportModule'; 19 | 20 | /** 21 | * @whatsapp WAWebContactPresenceBridge 22 | */ 23 | export declare function subscribePresence(id: Wid, tcToken?: any): Promise; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | subscribePresence: 'subscribePresence', 29 | }, 30 | (m) => m.subscribePresence 31 | ); 32 | -------------------------------------------------------------------------------- /src/conn/events/registerMainInit.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { internalEv } from '../../eventEmitter'; 18 | import * as webpack from '../../webpack'; 19 | import { isMainInit } from '../functions'; 20 | 21 | webpack.onInjected(register); 22 | 23 | function register() { 24 | const check = setInterval(() => { 25 | if (isMainInit()) { 26 | clearInterval(check); 27 | internalEv.emit('conn.main_init'); 28 | } 29 | }, 100); 30 | } 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/selectChatForOneOnOneMessage.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2025 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 973480 >= 2.2241.6 21 | */ 22 | export declare function selectChatForOneOnOneMessage(params: any): Promise; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | selectChatForOneOnOneMessage: 'selectChatForOneOnOneMessage', 28 | }, 29 | (m) => m.selectChatForOneOnOneMessage 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/sendDelete.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { ChatModel } from '..'; 18 | import { exportModule } from '../exportModule'; 19 | 20 | /** @whatsapp 20052 21 | * @whatsapp 920052 >= 2.2222.8 22 | * @whatsapp 43125 >= 2.2228.4 23 | */ 24 | export declare function sendDelete(chat: ChatModel): Promise; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | sendDelete: 'sendDelete', 30 | }, 31 | (m) => m.sendDelete 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/websocket/sendSmaxStanza.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { WapNode } from './'; 19 | 20 | /** 21 | * @whatsapp 67201 >= 2.2301.6 22 | */ 23 | export declare function sendSmaxStanza( 24 | node: WapNode, 25 | options?: any 26 | ): Promise; 27 | 28 | exportModule( 29 | exports, 30 | { 31 | sendSmaxStanza: 'sendSmaxStanza', 32 | }, 33 | (m) => m.sendSmaxStanza 34 | ); 35 | -------------------------------------------------------------------------------- /src/profile/functions/setMyProfileName.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { functions } from '../../whatsapp'; 18 | 19 | /** 20 | * Update your current profile name 21 | * 22 | * @example 23 | * ```javascript 24 | * await WPP.profile.setMyProfileName('My new name'); 25 | * ``` 26 | * 27 | * @category Profile 28 | */ 29 | 30 | export async function setMyProfileName(name: string) { 31 | await functions.setPushname(name); 32 | 33 | return true; 34 | } 35 | -------------------------------------------------------------------------------- /src/util/generateOrderUniqueId.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export function generateOrderUniqueId(): string { 18 | const timestamp = String(Date.now()); 19 | const randomPart = Math.random().toFixed(4).slice(-4); 20 | const combinedValue = timestamp + randomPart; 21 | 22 | const uniqueId = 23 | typeof BigInt === 'function' 24 | ? BigInt(combinedValue) 25 | : Number(combinedValue); 26 | 27 | return uniqueId.toString(36).toUpperCase(); 28 | } 29 | -------------------------------------------------------------------------------- /src/whatsapp/functions/createOrder.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** 21 | * @whatsapp 990553 22 | */ 23 | export declare function createOrder( 24 | wid: Wid, 25 | cartItems?: any 26 | ): Promise<{ id: number; token: any; price?: any }>; 27 | 28 | exportModule( 29 | exports, 30 | { 31 | createOrder: 'createOrder', 32 | }, 33 | (m) => m.createOrder 34 | ); 35 | -------------------------------------------------------------------------------- /src/whatsapp/functions/GROUP_JID.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** 21 | * @whatsapp 355813 22 | */ 23 | export declare function GROUP_JID(jid: Wid): any; 24 | export declare function CHAT_JID(jid: Wid): any; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | GROUP_JID: 'GROUP_JID', 30 | CHAT_JID: 'CHAT_JID', 31 | }, 32 | (m) => m.GROUP_JID && m.CHAT_JID 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getABPropConfigValue.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 95547 21 | * @whatsapp 695547 >= 2.2222.8 22 | * @whatsapp 925080 >= 2.2228.4 23 | */ 24 | 25 | export declare function getABPropConfigValue(value: any): any; 26 | 27 | exportModule( 28 | exports, 29 | { 30 | getABPropConfigValue: 'getABPropConfigValue', 31 | }, 32 | (m) => m.getABPropConfigValue 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/functions/joinGroupViaInvite.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '..'; 18 | import { exportModule } from '../exportModule'; 19 | 20 | /** 21 | * @whatsapp 153438 >= 2.2301.5 22 | */ 23 | export declare function joinGroupViaInvite(groupId: Wid): Promise<{ gid: Wid }>; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | joinGroupViaInvite: 'joinGroupViaInvite', 29 | }, 30 | (m) => m.joinGroupViaInvite && m.resetGroupInviteCode 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/websocket/stopComms.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../../whatsapp/exportModule'; 18 | 19 | /** 20 | * @whatsapp 67201 21 | */ 22 | export declare function stopComms(): Promise; 23 | export declare function startHandlingRequests(): Promise; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | stopComms: 'stopComms', 29 | startHandlingRequests: 'startHandlingRequests', 30 | }, 31 | (m) => m.stopComms 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getChatRecordByAccountLid.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2025 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** 21 | * @whatsapp WAWebApiChat >= 2.3000.0 22 | */ 23 | export declare function getChatRecordByAccountLid(a: Wid): Promise; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | getChatRecordByAccountLid: 'getChatRecordByAccountLid', 29 | }, 30 | (m) => m.getChatRecordByAccountLid 31 | ); 32 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getCommunityParticipants.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** 21 | * @whatsapp 673427 22 | */ 23 | export declare function getCommunityParticipants( 24 | communityId: Wid 25 | ): Promise; 26 | 27 | exportModule( 28 | exports, 29 | { 30 | getCommunityParticipants: 'getCommunityParticipants', 31 | }, 32 | (m) => m.getCommunityParticipants 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/functions/resetGroupInviteCode.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '..'; 18 | import { exportModule } from '../exportModule'; 19 | 20 | /** 21 | * @whatsapp 153438 >= 2.2301.5 22 | */ 23 | export declare function resetGroupInviteCode( 24 | groupId: Wid 25 | ): Promise<{ code: string }>; 26 | 27 | exportModule( 28 | exports, 29 | { 30 | resetGroupInviteCode: 'resetGroupInviteCode', 31 | }, 32 | (m) => m.resetGroupInviteCode 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/functions/sendExitGroup.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { ChatModel } from '..'; 18 | import { exportModule } from '../exportModule'; 19 | 20 | /** @whatsapp 5501 21 | * @whatsapp 605501 >= 2.2222.8 22 | * @whatsapp 525510 >= 2.2228.4 23 | */ 24 | export declare function sendExitGroup(group: ChatModel): Promise; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | sendExitGroup: 'sendExitGroup', 30 | }, 31 | (m) => m.sendExitGroup 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './collections'; 18 | export * as contants from './contants'; 19 | export * as enums from './enums'; 20 | export { _moduleIdMap } from './exportModule'; 21 | export * as functions from './functions'; 22 | export * from './misc'; 23 | export * from './models'; 24 | export * as multidevice from './multidevice'; 25 | export * from './stores'; 26 | export * from './types'; 27 | export * as websocket from './websocket'; 28 | -------------------------------------------------------------------------------- /src/catalog/functions/getMyCatalog.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { CatalogStore, UserPrefs } from '../../whatsapp'; 18 | /** 19 | * Get your current catalog 20 | * 21 | * @example 22 | * ```javascript 23 | * // Get your current catalog 24 | * const myCatalog = await WPP.catalog.getMyCatalog(); 25 | * ``` 26 | * 27 | * @return Your current catalog 28 | */ 29 | export async function getMyCatalog() { 30 | return CatalogStore.get(UserPrefs.getMaybeMePnUser()); 31 | } 32 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getExisting.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2025 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | import { ChatModel } from '../models'; 20 | 21 | /** 22 | * @whatsapp WAWebChatGetExistingBridge >= 2.3000.0 23 | */ 24 | export declare function getExisting(chatId: Wid): Promise; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | getExisting: 'getExisting', 30 | }, 31 | (m) => m.getExisting 32 | ); 33 | -------------------------------------------------------------------------------- /src/conn/events/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './registerAuthCodeChangeEvent'; 18 | import './registerAuthenticatedEvent'; 19 | import './registerLogoutEvent'; 20 | import './registerLogoutReasonEvent'; 21 | import './registerMainInit'; 22 | import './registerMainLoadedEvent'; 23 | import './registerMainReadyEvent'; 24 | import './registerNeedsUpdateEvent'; 25 | import './registerOnlineEvent'; 26 | import './registerQRCodeIdleEvent'; 27 | import './registerRequireAuthEvent'; 28 | -------------------------------------------------------------------------------- /src/whatsapp/enums/KIC_ENTRY_POINT_TYP.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 982015 21 | */ 22 | export declare enum KIC_ENTRY_POINT_TYPE { 23 | CHAT_INFO = 1, 24 | SEARCH = 2, 25 | CHAT = 3, 26 | MEDIA = 4, 27 | DOCS = 5, 28 | LINKS = 6, 29 | } 30 | 31 | exportModule( 32 | exports, 33 | { 34 | KIC_ENTRY_POINT_TYPE: 'KIC_ENTRY_POINT_TYPE', 35 | }, 36 | (m) => m.KIC_ENTRY_POINT_TYPE 37 | ); 38 | -------------------------------------------------------------------------------- /src/whatsapp/functions/editBusinessProfile.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { BusinessProfileModel } from '../models'; 19 | 20 | /** 21 | * @whatsapp 461561 22 | */ 23 | export declare function editBusinessProfile( 24 | arguments: BusinessProfileModel 25 | ): Promise; 26 | 27 | exportModule( 28 | exports, 29 | { 30 | editBusinessProfile: 'editBusinessProfile', 31 | }, 32 | (m) => m.editBusinessProfile 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/functions/queryGroupInviteCode.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '..'; 18 | import { exportModule } from '../exportModule'; 19 | 20 | /** 21 | * @whatsapp 153438 22 | */ 23 | export declare function queryGroupInviteCode( 24 | groupId: Wid, 25 | iAmAdmin: boolean 26 | ): Promise<{ code: string }>; 27 | 28 | exportModule( 29 | exports, 30 | { 31 | queryGroupInviteCode: 'queryGroupInviteCode', 32 | }, 33 | (m) => m.queryGroupInviteCode 34 | ); 35 | -------------------------------------------------------------------------------- /src/whatsapp/websocket/wap.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { WapNode } from './WapNode'; 19 | 20 | /** 21 | * @whatsapp 504784 >= 2.2301.6 22 | */ 23 | export declare function wap( 24 | tag: any, 25 | attrs?: { [key: string]: any }, 26 | content?: any[] | string | null | ArrayBuffer | Uint8Array 27 | ): WapNode; 28 | 29 | exportModule( 30 | exports, 31 | { 32 | wap: 'wap', 33 | }, 34 | (m) => m.wap 35 | ); 36 | -------------------------------------------------------------------------------- /src/conn/events/registerOnlineEvent.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { internalEv } from '../../eventEmitter'; 18 | import * as webpack from '../../webpack'; 19 | import { NetworkStatus, NetworkStatusModel } from '../../whatsapp'; 20 | 21 | webpack.onInjected(register); 22 | 23 | function register() { 24 | NetworkStatus.on( 25 | 'change:online', 26 | (model: NetworkStatusModel, online: boolean) => { 27 | internalEv.emit('conn.online', online); 28 | } 29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /src/privacy/functions/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { get } from './get'; 18 | export { getDisallowedList } from './getDisallowedList'; 19 | export { setAbout } from './setAbout'; 20 | export { setAddGroup } from './setAddGroup'; 21 | export { setLastSeen } from './setLastSeen'; 22 | export { setOnline } from './setOnline'; 23 | export { setProfilePic } from './setProfilePic'; 24 | export { setReadReceipts } from './setReadReceipts'; 25 | export { setStatus } from './setStatus'; 26 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getFanOutList.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** 21 | * @whatsapp 16104 22 | * @whatsapp 416104 >= 2.2222.8 23 | * @whatsapp 963388 >= 2.2224.7 24 | */ 25 | export declare function getFanOutList(param: { wids: Wid[] }): Promise; 26 | 27 | exportModule( 28 | exports, 29 | { 30 | getFanOutList: 'getFanOutList', 31 | }, 32 | (m) => m.getFanOutList 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getMembershipApprovalRequests.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** @whatsapp 779423 21 | */ 22 | export declare function getMembershipApprovalRequests( 23 | groupId: Wid 24 | ): Promise; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | getMembershipApprovalRequests: 'getMembershipApprovalRequests', 30 | }, 31 | (m) => m.getMembershipApprovalRequests 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/functions/isLidMigrated.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp WAWebLidMigrationUtils >= 2.3000.x 21 | */ 22 | export declare function isLidMigrated(): boolean; 23 | 24 | exportModule( 25 | exports, 26 | { 27 | isLidMigrated: ['Lid1X1MigrationUtils.isLidMigrated'], 28 | }, 29 | (m) => 30 | m.Lid1X1MigrationUtils && 31 | typeof m.Lid1X1MigrationUtils.isLidMigrated === 'function' 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/misc/Enviroment.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | export declare const Enviroment: { 20 | default: { 21 | isWeb: boolean; 22 | isWindows: boolean; 23 | isGuest: boolean; 24 | }; 25 | }; 26 | 27 | exportModule( 28 | exports, 29 | 'Enviroment', 30 | (m) => 31 | (m.default.isWeb !== undefined && m.default.isWindows !== undefined) || 32 | (m.isWeb !== undefined && m.isWindows !== undefined) 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/misc/ImageUtils.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** @whatsapp 51428 20 | * @whatsapp 36638 >= 2.2204.13 21 | * @whatsapp 551428 >= 2.2222.8 22 | */ 23 | export declare namespace ImageUtils { 24 | function rotateAndResize( 25 | e: any, 26 | t: any, 27 | r: any 28 | ): Promise<{ width: number; height: number; images: any }>; 29 | } 30 | 31 | exportModule(exports, 'ImageUtils', (m) => m.rotateAndResize); 32 | -------------------------------------------------------------------------------- /src/whatsapp/websocket/smax.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { WapNode } from './WapNode'; 19 | 20 | /** 21 | * @whatsapp 898165 >= 2.2301.6 22 | */ 23 | export declare function smax( 24 | tag: any, 25 | attrs?: { [key: string]: any }, 26 | content?: any[] | string | null | ArrayBuffer | Uint8Array 27 | ): WapNode; 28 | 29 | exportModule( 30 | exports, 31 | { 32 | smax: 'smax', 33 | }, 34 | (m) => m.smax 35 | ); 36 | -------------------------------------------------------------------------------- /src/chat/events/index.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import './registerAckMessageEvent'; 18 | import './registerActiveChatEvent'; 19 | import './registerLiveLocationUpdateEvent'; 20 | import './registerNewMessageEvent'; 21 | import './registerPollEvent'; 22 | import './registerPresenceChange'; 23 | import './registerReactionsEvent'; 24 | import './registerRevokeMessageEvent'; 25 | import './registerLabelEvent'; 26 | import './registerEditedMessageEvent'; 27 | import './registerUnreadCountEvent'; 28 | -------------------------------------------------------------------------------- /src/group/functions/getGroupSizeLimit.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { functions } from '../../whatsapp'; 18 | 19 | /** 20 | * Get the max number of participants for a group 21 | * 22 | * @example 23 | * ```javascript 24 | * const limit = await WPP.group.getGroupSizeLimit(); 25 | * console.log(limit); 26 | * ``` 27 | * 28 | * @category Group 29 | */ 30 | export async function getGroupSizeLimit() { 31 | const limit = functions.getGroupSizeLimit(); 32 | 33 | return limit; 34 | } 35 | -------------------------------------------------------------------------------- /src/whatsapp/functions/updateMessageTable.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2025 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MsgKey } from '../misc'; 19 | 20 | /** @whatsapp WAWebDBUpdateMessageTable */ 21 | export declare function updateMessageTable( 22 | msgKey: MsgKey, 23 | updateFields: Record 24 | ): Promise; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | updateMessageTable: 'updateMessageTable', 30 | }, 31 | (m) => m.updateMessageTable 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/misc/USyncUser.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 459857 21 | */ 22 | export declare class USyncUser { 23 | constructor(); 24 | withPhone(a: any): any; 25 | withId(a: any): any; 26 | withLid(a: any): any; 27 | withType(a: any): any; 28 | withUsername(a: any): any; 29 | } 30 | 31 | exportModule( 32 | exports, 33 | { 34 | USyncUser: 'USyncUser', 35 | }, 36 | (m) => m.USyncUser 37 | ); 38 | -------------------------------------------------------------------------------- /src/chat/functions/closeChat.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Cmd } from '../../whatsapp'; 18 | import { getActiveChat } from '.'; 19 | 20 | /** 21 | * Close the chat tab 22 | * 23 | * @example 24 | * ```javascript 25 | * await WPP.chat.closeChat(); 26 | * ``` 27 | * 28 | * @category Chat 29 | */ 30 | export async function closeChat(): Promise { 31 | const active = getActiveChat(); 32 | if (!active) return false; 33 | Cmd.closeChat(active); 34 | 35 | return true; 36 | } 37 | -------------------------------------------------------------------------------- /src/conn/events/registerMainLoadedEvent.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { internalEv } from '../../eventEmitter'; 18 | import * as webpack from '../../webpack'; 19 | import { Cmd } from '../../whatsapp'; 20 | 21 | webpack.onInjected(register); 22 | 23 | function register() { 24 | const trigger = async () => { 25 | internalEv.emit('conn.main_loaded'); 26 | }; 27 | 28 | if (Cmd.isMainLoaded) { 29 | trigger(); 30 | } else { 31 | Cmd.on('main_loaded', trigger); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/conn/functions/isMainReady.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { internalEv } from '../../eventEmitter'; 18 | 19 | let isReady = false; 20 | 21 | internalEv.once('conn.main_ready', () => { 22 | isReady = true; 23 | }); 24 | 25 | /** 26 | * Check is main interface is authenticated, loaded and synced 27 | * 28 | * @example 29 | * ```javascript 30 | * const isMainReady = WPP.conn.isMainReady(); 31 | * ``` 32 | */ 33 | export function isMainReady(): boolean { 34 | return isReady; 35 | } 36 | -------------------------------------------------------------------------------- /src/conn/types.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export interface AuthCodeSingleDevice { 18 | type: 'single'; 19 | ref: string; 20 | keyPair: string; 21 | browserId: string; 22 | fullCode: string; 23 | } 24 | 25 | export interface AuthCodeMultiDevice { 26 | type: 'multidevice'; 27 | ref: string; 28 | staticKeyPair: string; 29 | identityKeyPair: string; 30 | secretKey: string; 31 | fullCode: string; 32 | } 33 | 34 | export type AuthCode = AuthCodeSingleDevice | AuthCodeMultiDevice; 35 | -------------------------------------------------------------------------------- /src/util/wrapFunction.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { InferArgs, InferReturn } from './types'; 18 | 19 | /** 20 | * Wrap a function with the callback 21 | */ 22 | export function wrapFunction any>( 23 | func: TFunc, 24 | callback: (func: TFunc, ...args: InferArgs) => InferReturn 25 | ): (...args: InferArgs) => InferReturn { 26 | return (...args: InferArgs) => { 27 | return callback(func, ...args); 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /src/conn/functions/getMyUserId.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '../../whatsapp'; 18 | import { getMyUserWid } from './getMyUserWid'; 19 | 20 | /** 21 | * Return the current logged user ID without device id 22 | * 23 | * @example 24 | * ```javascript 25 | * const wid = WPP.conn.getMyUserId(); 26 | * console.log(wid.toString()); // Output: 123@c.us 27 | * ``` 28 | */ 29 | export function getMyUserId(): Wid | undefined { 30 | const user = getMyUserWid(); 31 | return user; 32 | } 33 | -------------------------------------------------------------------------------- /src/whatsapp/functions/colorIndexToHex.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 885910 21 | */ 22 | export declare function colorIndexToHex(index: number): string; 23 | export declare function getAllLabelColors(): string[]; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | colorIndexToHex: 'colorIndexToHex', 29 | getAllLabelColors: 'getAllLabelColors', 30 | }, 31 | (m) => m.colorIndexToHex && m.getAllLabelColors 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/functions/createNewsletterQuery.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 874705 21 | */ 22 | export declare function createNewsletterQuery(opts: { 23 | name: string; 24 | description: string | null; 25 | picture: string | null; //base64 string 26 | }): any; 27 | 28 | exportModule( 29 | exports, 30 | { 31 | createNewsletterQuery: 'createNewsletterQuery', 32 | }, 33 | (m) => m.createNewsletterQuery 34 | ); 35 | -------------------------------------------------------------------------------- /src/whatsapp/functions/genLinkDeviceCodeForPhoneNumber.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 61777 21 | */ 22 | export declare function genLinkDeviceCodeForPhoneNumber( 23 | phone: string, 24 | pushNotification: boolean 25 | ): Promise; 26 | 27 | exportModule( 28 | exports, 29 | { 30 | genLinkDeviceCodeForPhoneNumber: 'genLinkDeviceCodeForPhoneNumber', 31 | }, 32 | (m) => m.genLinkDeviceCodeForPhoneNumber 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/functions/getNumChatsPinned.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** 20 | * @whatsapp 95547 21 | * @whatsapp 695547 >= 2.2222.8 22 | * @whatsapp 925080 >= 2.2228.4 23 | */ 24 | export declare function getNumChatsPinned(value: any): any; 25 | 26 | exportModule( 27 | exports, 28 | { 29 | getNumChatsPinned: ['getNumChatsPinned', 'getNumConversationsPinned'], 30 | }, 31 | (m) => m.getNumChatsPinned || m.getNumConversationsPinned 32 | ); 33 | -------------------------------------------------------------------------------- /src/whatsapp/functions/isFilterExcludedFromSearchTreatmentInInboxFlow.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2024 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | export declare function isFilterExcludedFromSearchTreatmentInInboxFlow( 20 | type?: string 21 | ): boolean; 22 | 23 | exportModule( 24 | exports, 25 | { 26 | isFilterExcludedFromSearchTreatmentInInboxFlow: 27 | 'isFilterExcludedFromSearchTreatmentInInboxFlow', 28 | }, 29 | (m) => m.isFilterExcludedFromSearchTreatmentInInboxFlow 30 | ); 31 | -------------------------------------------------------------------------------- /src/whatsapp/functions/sendTextMsgToChat.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** @whatsapp 5524 20 | * @whatsapp 105524 >= 2.2222.8 21 | * @whatsapp 781845 >= 2.2228.4 22 | */ 23 | export declare function sendTextMsgToChat( 24 | chat: any, 25 | message: any, 26 | options: any 27 | ): Promise; 28 | 29 | exportModule( 30 | exports, 31 | { 32 | sendTextMsgToChat: 'sendTextMsgToChat', 33 | }, 34 | (m) => m.sendTextMsgToChat 35 | ); 36 | -------------------------------------------------------------------------------- /src/chat/functions/get.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { assertWid } from '../../assert'; 18 | import { ChatModel, ChatStore, NewsletterStore, Wid } from '../../whatsapp'; 19 | 20 | /** 21 | * Find a chat by id 22 | * 23 | * @category Chat 24 | */ 25 | export function get(chatId: string | Wid): ChatModel | undefined { 26 | const wid = assertWid(chatId); 27 | if (wid.server === 'newsletter') { 28 | return NewsletterStore.get(wid); 29 | } else { 30 | return ChatStore.get(wid); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/conn/events/registerNeedsUpdateEvent.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { internalEv } from '../../eventEmitter'; 18 | import * as webpack from '../../webpack'; 19 | import { Stream } from '../../whatsapp'; 20 | 21 | webpack.onInjected(register); 22 | 23 | function register() { 24 | const trigger = async () => { 25 | internalEv.emit('conn.needs_update'); 26 | }; 27 | 28 | if (Stream.needsUpdate) { 29 | trigger(); 30 | } else { 31 | Stream.on('change:needsUpdate', trigger); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/conn/functions/setMultiDevice.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Cmd } from '../../whatsapp'; 18 | 19 | /** 20 | * @param md If it's true, WhatsApp WEB will switch to MD. If it's false, WhatsApp WEB will switch to Legacy. 21 | * @example 22 | * ```javascript 23 | * WPP.conn.setMultiDevice(true) 24 | * ``` 25 | */ 26 | export function setMultiDevice(md = true): boolean { 27 | if (md) { 28 | Cmd.upgradeToMDProd(); 29 | } else { 30 | Cmd.downgradeWebclient(); 31 | } 32 | return true; 33 | } 34 | -------------------------------------------------------------------------------- /src/profile/functions/getMyStatus.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { getMyUserWid } from '../../conn/functions/getMyUserWid'; 18 | import { StatusStore } from '../../whatsapp'; 19 | 20 | /** 21 | * Get your current text status 22 | * 23 | * @example 24 | * ```javascript 25 | * await WPP.profile.getMyStatus(); 26 | * ``` 27 | * 28 | * @category Profile 29 | */ 30 | 31 | export async function getMyStatus() { 32 | const myStatus = await StatusStore.find(getMyUserWid()); 33 | return myStatus.status; 34 | } 35 | -------------------------------------------------------------------------------- /src/order/events/eventTypes.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { MsgKey } from '../../whatsapp'; 18 | 19 | export interface OrderEventTypes { 20 | /** 21 | * Triggered when change the active chat 22 | * 23 | * @example 24 | * ```javascript 25 | * WPP.on('order.payment_status', (order) => { 26 | * // Your code 27 | * }); 28 | * ``` 29 | */ 30 | 'order.payment_status': { 31 | method: string; 32 | timestamp: number; 33 | reference_id: string; 34 | msgId: MsgKey; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /src/whatsapp/functions/typeAttributeFromProtobuf.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** @whatsapp 93650 20 | * @whatsapp 193650 >= 2.2222.8 21 | * @whatsapp 985947 >= 2.2228.4 22 | */ 23 | export declare function typeAttributeFromProtobuf(protoMessage: { 24 | [key: string]: any; 25 | }): string; 26 | 27 | exportModule( 28 | exports, 29 | { 30 | typeAttributeFromProtobuf: 'typeAttributeFromProtobuf', 31 | }, 32 | (m) => m.typeAttributeFromProtobuf 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/functions/uploadProductImage.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { OpaqueData } from '..'; 18 | import { exportModule } from '../exportModule'; 19 | 20 | /** @whatsapp 78986 21 | * @whatsapp 778986 >= 2.2222.8 22 | */ 23 | export declare function uploadProductImage( 24 | mediaBlob: OpaqueData, 25 | filehash: string 26 | ): Promise; 27 | 28 | exportModule( 29 | exports, 30 | { 31 | uploadProductImage: 'uploadProductImage', 32 | }, 33 | (m) => m.uploadProductImage && m.MediaPrep 34 | ); 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/support_question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Support Question 3 | about: 'Please use GitHub Discussions for questions! This template is for legacy issues only.' 4 | labels: 'question, needs triage' 5 | --- 6 | 7 | ## ⚠️ Please use GitHub Discussions for support questions 8 | 9 | We've moved support questions to **[GitHub Discussions](https://github.com/wppconnect-team/wa-js/discussions)** for better community engagement! 10 | 11 | **Before creating a discussion, please:** 12 | 13 | 1. Search through existing discussions 14 | 2. Read through the [documentation](https://wppconnect-team.github.io/wa-js/) 15 | 3. Check the readme for examples 16 | 17 | ## Support Resources 18 | 19 | - **GitHub Discussions**: https://github.com/wppconnect-team/wa-js/discussions (Recommended for questions) 20 | - **Documentation**: https://wppconnect-team.github.io/wa-js/ 21 | - **Discord**: https://discord.gg/JU5JGGKGNG 22 | - **WhatsApp Group**: https://chat.whatsapp.com/LJaQu6ZyNvnBPNAVRbX00K 23 | 24 | --- 25 | 26 | **Note:** Issues are for bug reports and feature requests only. Support questions will be converted to discussions or closed. 27 | -------------------------------------------------------------------------------- /src/whatsapp/functions/findFirstWebLink.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { LinkUrlData } from './fetchLinkPreview'; 19 | 20 | /** @whatsapp 29929 21 | * @whatsapp 31042 >= 2.2204.13 22 | * @whatsapp 829929 >= 2.2222.8 23 | */ 24 | export declare function findFirstWebLink( 25 | message: string 26 | ): undefined | LinkUrlData; 27 | 28 | exportModule( 29 | exports, 30 | { 31 | findFirstWebLink: 'findFirstWebLink', 32 | }, 33 | (m) => m.findFirstWebLink 34 | ); 35 | -------------------------------------------------------------------------------- /src/chat/functions/unmute.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { assertGetChat, assertWid } from '../../assert'; 18 | import { Wid } from '../../whatsapp'; 19 | 20 | /** 21 | * Unmute a chat 22 | * 23 | * @example 24 | * ```javascript 25 | * WPP.chat.unmute('[number]@c.us'); 26 | * ``` 27 | * 28 | * @category Chat 29 | */ 30 | export async function unmute(chatId: string | Wid) { 31 | const wid = assertWid(chatId); 32 | 33 | const chat = assertGetChat(wid); 34 | 35 | return chat.mute.unmute({ sendDevice: true }); 36 | } 37 | -------------------------------------------------------------------------------- /src/whatsapp/functions/findCommonGroups.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { BaseCollection } from '../collections'; 18 | import { exportModule } from '../exportModule'; 19 | import { ChatModel, ContactModel } from '../models'; 20 | 21 | /** 22 | * @whatsapp 714574 23 | */ 24 | export declare function findCommonGroups( 25 | wid: ContactModel 26 | ): Promise>; 27 | 28 | exportModule( 29 | exports, 30 | { 31 | findCommonGroups: 'findCommonGroups', 32 | }, 33 | (m) => m.findCommonGroups 34 | ); 35 | -------------------------------------------------------------------------------- /src/whatsapp/functions/randomId.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** @whatsapp 65212 20 | * @whatsapp 15860 >= 2.2204.13 21 | * @whatsapp 465212 >= 2.2222.8 22 | * @returns Promise for @whatsapp >= 2.2321.4 23 | * @returns string for @whatsapp < 2.2321.4 24 | */ 25 | export declare function randomMessageId(): string | Promise; 26 | 27 | exportModule( 28 | exports, 29 | { 30 | randomMessageId: ['default.newId'], 31 | }, 32 | (m) => m.default.newId 33 | ); 34 | -------------------------------------------------------------------------------- /src/whatsapp/functions/canEditMsg.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2022 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MsgModel } from '../models'; 19 | 20 | /** 21 | * @whatsapp 755707 >= 2.2307.10 22 | */ 23 | export declare function canEditMsg(msg: MsgModel): boolean; 24 | 25 | exportModule( 26 | exports, 27 | { 28 | canEditMsg: [ 29 | 'canEditText', // @whatsapp >= 2.2318.7 30 | 'canEditMsg', 31 | ], 32 | }, 33 | (m) => 34 | m.canEditMsg || // @whatsapp >= 2.2318.7 35 | m.canEditText 36 | ); 37 | -------------------------------------------------------------------------------- /src/whatsapp/functions/encryptMsgProtobuf.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2023 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { Wid } from '../misc'; 19 | 20 | /** 21 | * @whatsapp 309029 >= 2.2312.7 22 | */ 23 | export declare function encryptMsgProtobuf( 24 | wid: Wid, 25 | retryCount: number, 26 | protoMessage: any 27 | ): Promise<{ type: string; ciphertext: Uint8Array }>; 28 | 29 | exportModule( 30 | exports, 31 | { 32 | encryptMsgProtobuf: 'encryptMsgProtobuf', 33 | }, 34 | (m) => m.encryptMsgProtobuf 35 | ); 36 | -------------------------------------------------------------------------------- /src/whatsapp/functions/createMsgProtobuf.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { MsgModel } from '..'; 18 | import { exportModule } from '../exportModule'; 19 | 20 | /** @whatsapp 6565 21 | * @whatsapp 606565 >= 2.2222.8 22 | * @whatsapp 615947 >= 2.2228.4 23 | */ 24 | export declare function createMsgProtobuf( 25 | e: MsgModel, 26 | t?: { [key: string]: any } 27 | ): { [key: string]: any }; 28 | 29 | exportModule( 30 | exports, 31 | { 32 | createMsgProtobuf: 'createMsgProtobuf', 33 | }, 34 | (m) => m.createMsgProtobuf 35 | ); 36 | -------------------------------------------------------------------------------- /src/whatsapp/functions/mediaTypeFromProtobuf.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** @whatsapp 95318 20 | * @whatsapp 58853 >= 2.2218.4 21 | * @whatsapp 458853 >= 2.2222.8 22 | * @whatsapp 760210 >= 2.2228.4 23 | */ 24 | export declare function mediaTypeFromProtobuf(protoMessage: { 25 | [key: string]: any; 26 | }): string | null; 27 | 28 | exportModule( 29 | exports, 30 | { 31 | mediaTypeFromProtobuf: 'mediaTypeFromProtobuf', 32 | }, 33 | (m) => m.mediaTypeFromProtobuf 34 | ); 35 | -------------------------------------------------------------------------------- /src/whatsapp/functions/sendReactionToMsg.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | import { MsgModel } from '../models'; 19 | 20 | /** @whatsapp 21357 21 | * @whatsapp 621357 >= 2.2222.8 22 | * @whatsapp 805687 >= 2.2228.4 23 | */ 24 | export declare function sendReactionToMsg( 25 | msg: MsgModel, 26 | reactionText: string 27 | ): Promise; 28 | 29 | exportModule( 30 | exports, 31 | { 32 | sendReactionToMsg: 'sendReactionToMsg', 33 | }, 34 | (m) => m.sendReactionToMsg 35 | ); 36 | -------------------------------------------------------------------------------- /src/assert/assertWid.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { createWid, WPPError } from '../util'; 18 | import { Wid } from '../whatsapp'; 19 | 20 | export class InvalidWid extends WPPError { 21 | constructor(readonly id: string | { _serialized: string }) { 22 | super('invalid_wid', `Invalid WID value for ${id}`); 23 | } 24 | } 25 | 26 | export function assertWid(id: string | { _serialized: string }): Wid { 27 | const wid = createWid(id); 28 | 29 | if (!wid) { 30 | throw new InvalidWid(id); 31 | } 32 | 33 | return wid; 34 | } 35 | -------------------------------------------------------------------------------- /src/group/functions/getParticipants.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '../../whatsapp'; 18 | import { ensureGroup } from './'; 19 | 20 | /** 21 | * Get an array of participants of a group 22 | * 23 | * @example 24 | * ```javascript 25 | * WPP.group.getParticipants('[group-id]@g.us'); 26 | * ``` 27 | * 28 | * @category Group 29 | */ 30 | export async function getParticipants(groupId: string | Wid) { 31 | const groupChat = await ensureGroup(groupId); 32 | return groupChat.groupMetadata!.participants.getModelsArray(); 33 | } 34 | -------------------------------------------------------------------------------- /src/group/functions/leave.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { Wid } from '../../whatsapp'; 18 | import { sendExitGroup } from '../../whatsapp/functions'; 19 | import { ensureGroup } from '.'; 20 | 21 | /** 22 | * Leave from a group. 23 | * 24 | * @example 25 | * ```javascript 26 | * await WPP.group.leave('[number]@g.us'); 27 | * ``` 28 | * 29 | * @category Group 30 | */ 31 | export async function leave(groupId: string | Wid) { 32 | const groupChat = await ensureGroup(groupId); 33 | 34 | return await sendExitGroup(groupChat); 35 | } 36 | -------------------------------------------------------------------------------- /src/whatsapp/enums/OUTWARD_TYPES.ts: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { exportModule } from '../exportModule'; 18 | 19 | /** @whatsapp 58668 */ 20 | export declare enum OUTWARD_TYPES { 21 | IMAGE = 'image', 22 | VIDEO = 'video', 23 | AUDIO = 'audio', 24 | PTT = 'ptt', 25 | PTV = 'ptv', 26 | STICKER = 'sticker', 27 | DOCUMENT = 'document', 28 | PRODUCT = 'product', 29 | UNKNOWN = 'unknown', 30 | } 31 | 32 | exportModule( 33 | exports, 34 | { 35 | OUTWARD_TYPES: 'OUTWARD_TYPES', 36 | }, 37 | (m) => m.OUTWARD_TYPES 38 | ); 39 | --------------------------------------------------------------------------------