├── .prettierignore ├── CNAME ├── docs ├── static │ ├── .nojekyll │ ├── CNAME │ ├── img │ │ ├── logo.png │ │ ├── favicon.ico │ │ ├── docusaurus.png │ │ └── license-identifier.png │ └── js │ │ └── gumroad_docusaurus_cart_fix.js ├── docs │ ├── how-to │ │ ├── read-state.md │ │ ├── receive-files.md │ │ ├── sendfile.md │ │ ├── _category_.yml │ │ ├── create-api.md │ │ ├── incoming-calls.md │ │ ├── receive-messages.md │ │ ├── manage-participants.md │ │ ├── detect-logout.md │ │ ├── use-a-proxy.md │ │ ├── send-videos.md │ │ ├── misc.md │ │ ├── send-messages.md │ │ ├── location.md │ │ └── groups.md │ ├── advanced │ │ └── _category_.yml │ ├── Integrations │ │ ├── _category_.yml │ │ └── chatwoot.md │ ├── reference │ │ ├── controllers │ │ │ ├── init_patch │ │ │ │ └── index.md │ │ │ ├── initializer │ │ │ │ ├── variables │ │ │ │ │ ├── pkg.md │ │ │ │ │ ├── screenshot.md │ │ │ │ │ └── configWithCases.md │ │ │ │ ├── functions │ │ │ │ │ ├── timeout.md │ │ │ │ │ └── create.md │ │ │ │ └── index.md │ │ │ ├── events │ │ │ │ ├── index.md │ │ │ │ └── variables │ │ │ │ │ └── ev.md │ │ │ └── patch_manager │ │ │ │ ├── functions │ │ │ │ ├── earlyInjectionCheck.md │ │ │ │ └── getAndInjectLicense.md │ │ │ │ └── index.md │ │ ├── api │ │ │ ├── Client │ │ │ │ ├── variables │ │ │ │ │ └── useragent.md │ │ │ │ ├── index.md │ │ │ │ └── enumerations │ │ │ │ │ └── namespace.md │ │ │ ├── model │ │ │ │ ├── message │ │ │ │ │ ├── interfaces │ │ │ │ │ │ ├── QuoteMap.md │ │ │ │ │ │ ├── PollOption.md │ │ │ │ │ │ ├── MessageInfoInteraction.md │ │ │ │ │ │ ├── PollData.md │ │ │ │ │ │ ├── MessageInfo.md │ │ │ │ │ │ ├── ReactionSender.md │ │ │ │ │ │ └── PollVote.md │ │ │ │ │ ├── type-aliases │ │ │ │ │ │ └── MessagePinDuration.md │ │ │ │ │ ├── enumerations │ │ │ │ │ │ ├── MessageAck.md │ │ │ │ │ │ └── MessageTypes.md │ │ │ │ │ └── index.md │ │ │ │ ├── id │ │ │ │ │ ├── index.md │ │ │ │ │ └── interfaces │ │ │ │ │ │ └── Id.md │ │ │ │ ├── label │ │ │ │ │ ├── index.md │ │ │ │ │ └── interfaces │ │ │ │ │ │ └── Label.md │ │ │ │ ├── aliases │ │ │ │ │ ├── type-aliases │ │ │ │ │ │ ├── ChatServer.md │ │ │ │ │ │ ├── GetURL.md │ │ │ │ │ │ ├── GroupChatServer.md │ │ │ │ │ │ ├── GroupId.md │ │ │ │ │ │ ├── Content.md │ │ │ │ │ │ ├── FilePath.md │ │ │ │ │ │ ├── WaServers.md │ │ │ │ │ │ ├── AccountNumber.md │ │ │ │ │ │ ├── MessageId.md │ │ │ │ │ │ ├── AdvancedFile.md │ │ │ │ │ │ ├── ChatId.md │ │ │ │ │ │ ├── ContactId.md │ │ │ │ │ │ ├── GroupChatId.md │ │ │ │ │ │ ├── Base64.md │ │ │ │ │ │ ├── NonSerializedId.md │ │ │ │ │ │ ├── DataURL.md │ │ │ │ │ │ └── CountryCode.md │ │ │ │ │ └── index.md │ │ │ │ ├── events │ │ │ │ │ └── index.md │ │ │ │ ├── button │ │ │ │ │ ├── interfaces │ │ │ │ │ │ ├── Button.md │ │ │ │ │ │ ├── Section.md │ │ │ │ │ │ ├── Row.md │ │ │ │ │ │ ├── LocationButtonBody.md │ │ │ │ │ │ └── AdvancedButton.md │ │ │ │ │ └── index.md │ │ │ │ ├── chat │ │ │ │ │ ├── type-aliases │ │ │ │ │ │ ├── Chat.md │ │ │ │ │ │ └── EphemeralDuration.md │ │ │ │ │ ├── enumerations │ │ │ │ │ │ ├── ChatTypes.md │ │ │ │ │ │ ├── ChatState.md │ │ │ │ │ │ └── ChatMuteDuration.md │ │ │ │ │ ├── interfaces │ │ │ │ │ │ ├── GroupChatCreationResponse.md │ │ │ │ │ │ ├── LiveLocationChangedEvent.md │ │ │ │ │ │ └── GroupChatCreationParticipantAddResponse.md │ │ │ │ │ └── index.md │ │ │ │ ├── group-metadata │ │ │ │ │ ├── enumerations │ │ │ │ │ │ ├── groupChangeEvent.md │ │ │ │ │ │ └── GroupNotificationTypes.md │ │ │ │ │ ├── interfaces │ │ │ │ │ │ ├── NewCommunityGroup.md │ │ │ │ │ │ ├── Participant.md │ │ │ │ │ │ ├── ParticipantChangedEventModel.md │ │ │ │ │ │ └── GenericGroupChangeEvent.md │ │ │ │ │ └── index.md │ │ │ │ ├── media │ │ │ │ │ ├── variables │ │ │ │ │ │ └── defaultProcessOptions.md │ │ │ │ │ ├── index.md │ │ │ │ │ └── type-aliases │ │ │ │ │ │ └── Mp4StickerConversionProcessOptions.md │ │ │ │ ├── contact │ │ │ │ │ ├── interfaces │ │ │ │ │ │ ├── BizCategory.md │ │ │ │ │ │ ├── BizProfileOptions.md │ │ │ │ │ │ ├── NumberCheck.md │ │ │ │ │ │ └── BusinessHours.md │ │ │ │ │ └── index.md │ │ │ │ ├── call │ │ │ │ │ ├── index.md │ │ │ │ │ ├── enumerations │ │ │ │ │ │ └── CallState.md │ │ │ │ │ └── interfaces │ │ │ │ │ │ └── Call.md │ │ │ │ ├── sessionInfo │ │ │ │ │ ├── index.md │ │ │ │ │ └── interfaces │ │ │ │ │ │ ├── SessionInfo.md │ │ │ │ │ │ └── HealthCheck.md │ │ │ │ ├── type-aliases │ │ │ │ │ └── EasyApiResponse.md │ │ │ │ ├── config │ │ │ │ │ ├── interfaces │ │ │ │ │ │ ├── DevTools.md │ │ │ │ │ │ ├── SessionData.md │ │ │ │ │ │ ├── EventPayload.md │ │ │ │ │ │ ├── ProxyServerCredentials.md │ │ │ │ │ │ └── Webhook.md │ │ │ │ │ ├── type-aliases │ │ │ │ │ │ └── AdvancedConfig.md │ │ │ │ │ ├── enumerations │ │ │ │ │ │ ├── QRFormat.md │ │ │ │ │ │ ├── CLOUD_PROVIDERS.md │ │ │ │ │ │ ├── DIRECTORY_STRATEGY.md │ │ │ │ │ │ ├── NotificationLanguage.md │ │ │ │ │ │ ├── QRQuality.md │ │ │ │ │ │ ├── LicenseType.md │ │ │ │ │ │ └── OnError.md │ │ │ │ │ └── index.md │ │ │ │ ├── enumerations │ │ │ │ │ ├── Status.md │ │ │ │ │ └── Events.md │ │ │ │ ├── reactions │ │ │ │ │ ├── index.md │ │ │ │ │ └── type-aliases │ │ │ │ │ │ ├── Reaction.md │ │ │ │ │ │ ├── ReactionEvent.md │ │ │ │ │ │ └── ReactionRecord.md │ │ │ │ ├── product │ │ │ │ │ ├── index.md │ │ │ │ │ └── interfaces │ │ │ │ │ │ ├── CartItem.md │ │ │ │ │ │ ├── Order.md │ │ │ │ │ │ └── CustomProduct.md │ │ │ │ └── errors │ │ │ │ │ ├── index.md │ │ │ │ │ ├── enumerations │ │ │ │ │ ├── AddParticipantErrorStatusCode.md │ │ │ │ │ └── ERROR_NAME.md │ │ │ │ │ └── classes │ │ │ │ │ ├── SessionExpiredError.md │ │ │ │ │ └── PageEvaluationTimeout.md │ │ │ └── functions │ │ │ │ └── exposed.enum │ │ │ │ ├── index.md │ │ │ │ └── enumerations │ │ │ │ └── ExposedFn.md │ │ ├── structures │ │ │ ├── Dialog │ │ │ │ ├── interfaces │ │ │ │ │ ├── CurrentDialogProps.md │ │ │ │ │ ├── DialogButtons.md │ │ │ │ │ ├── DialogListMessageRow.md │ │ │ │ │ ├── DialogListMessageSection.md │ │ │ │ │ ├── DialogValidation.md │ │ │ │ │ ├── DialogTemplate.md │ │ │ │ │ └── DialogProperty.md │ │ │ │ ├── enumerations │ │ │ │ │ └── ValidationType.md │ │ │ │ ├── type-aliases │ │ │ │ │ └── CheckFunction.md │ │ │ │ └── index.md │ │ │ ├── MessageCollector │ │ │ │ └── index.md │ │ │ ├── Collector │ │ │ │ ├── type-aliases │ │ │ │ │ └── CollectorFilter.md │ │ │ │ ├── index.md │ │ │ │ └── interfaces │ │ │ │ │ ├── CollectorOptions.md │ │ │ │ │ └── AwaitMessagesOptions.md │ │ │ └── preProcessors │ │ │ │ ├── variables │ │ │ │ └── MessagePreprocessors.md │ │ │ │ ├── index.md │ │ │ │ ├── type-aliases │ │ │ │ ├── MPConfigType.md │ │ │ │ └── MessagePreProcessor.md │ │ │ │ └── enumerations │ │ │ │ └── PREPROCESSORS.md │ │ ├── logging │ │ │ ├── logging │ │ │ │ ├── functions │ │ │ │ │ └── addRotateFileLogTransport.md │ │ │ │ ├── index.md │ │ │ │ ├── type-aliases │ │ │ │ │ └── ConfigLogTransport.md │ │ │ │ └── variables │ │ │ │ │ └── log.md │ │ │ └── custom_transport │ │ │ │ └── index.md │ │ └── index.md │ ├── concepts │ │ ├── _category_.json │ │ └── how-it-works.md │ ├── configuration │ │ ├── _category_.json │ │ ├── command-line-options.md │ │ ├── capture-qr.md │ │ ├── capture-sd.md │ │ ├── launch-events.md │ │ └── the-client.md │ ├── get-started │ │ ├── _category_.json │ │ ├── link-code.md │ │ ├── docker.md │ │ └── installation.md │ ├── intro.md │ └── api │ │ └── index.md ├── babel.config.js ├── src │ ├── pages │ │ ├── markdown-page.md │ │ ├── index.module.css │ │ └── index.tsx │ ├── theme │ │ ├── DocRoot │ │ │ └── Layout │ │ │ │ ├── styles.module.css │ │ │ │ ├── Main │ │ │ │ ├── styles.module.css │ │ │ │ └── index.tsx │ │ │ │ ├── Sidebar │ │ │ │ ├── ExpandButton │ │ │ │ │ ├── styles.module.css │ │ │ │ │ └── index.tsx │ │ │ │ └── styles.module.css │ │ │ │ └── index.tsx │ │ ├── Admonition │ │ │ ├── index.tsx │ │ │ └── Types.tsx │ │ └── NavbarItem │ │ │ └── ComponentTypes.tsx │ ├── lib │ │ └── utils.ts │ ├── components │ │ ├── HomepageFeatures │ │ │ ├── styles.module.css │ │ │ └── index.tsx │ │ ├── License │ │ │ └── index.tsx │ │ └── OpenReplay │ │ │ └── OpenReplay.ts │ ├── config │ │ ├── typedoc.ts │ │ └── consts.ts │ └── ui │ │ └── button.tsx ├── blog │ ├── 2021-08-26-welcome │ │ ├── docusaurus-plushie-banner.jpeg │ │ └── index.md │ ├── tags.yml │ ├── 2019-05-28-first-blog-post.md │ ├── authors.yml │ └── 2021-08-01-mdx-blog-post.mdx ├── tsconfig.json ├── .gitignore ├── components.json ├── plugins │ └── tailwind-config.ts ├── sidebars.ts ├── README.md └── package.json ├── .prettierrc ├── release.png ├── .deepsource.toml ├── resources ├── hotfix-logo.png └── membership.png ├── src ├── api │ ├── model │ │ ├── id.ts │ │ ├── button.ts │ │ ├── label.ts │ │ ├── call.ts │ │ ├── reactions.ts │ │ └── sessionInfo.ts │ └── functions │ │ └── exposed.enum.ts ├── lib │ └── README.md ├── utils │ └── pid_utils.ts ├── controllers │ ├── preload.js │ └── script_preloader.ts ├── index.ts ├── logging │ └── custom_transport.ts ├── cli │ └── file-utils.ts ├── structures │ └── Dialog.ts └── config │ └── puppeteer.config.ts ├── types-only ├── README.md ├── .npmignore ├── tsconfig.json └── package.json ├── .github ├── ISSUE_TEMPLATE │ └── config.yml ├── FUNDING.yml ├── workflows │ ├── docs-run.yml │ └── comment-run.yml └── dependabot.yml ├── prebuild.ts ├── docfix.ts ├── .gitignore ├── .release-it.json ├── .eslintrc.json ├── compact-keepachangelog.hbs ├── demo ├── message_queue.ts ├── server.ts ├── simple_server.ts └── Dockerfile ├── .npmignore ├── test └── test.js └── bin └── server.js /.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.js -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | docs.openwa.dev -------------------------------------------------------------------------------- /docs/static/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/docs/how-to/read-state.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/docs/how-to/receive-files.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/static/CNAME: -------------------------------------------------------------------------------- 1 | docs.openwa.dev -------------------------------------------------------------------------------- /docs/docs/how-to/sendfile.md: -------------------------------------------------------------------------------- 1 | # SendFile 2 | 3 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /docs/docs/advanced/_category_.yml: -------------------------------------------------------------------------------- 1 | label: "Advanced" 2 | position: 3 -------------------------------------------------------------------------------- /docs/docs/how-to/_category_.yml: -------------------------------------------------------------------------------- 1 | label: "How To" 2 | # position: 0 -------------------------------------------------------------------------------- /docs/docs/Integrations/_category_.yml: -------------------------------------------------------------------------------- 1 | label: "Integrations" 2 | position: 6 -------------------------------------------------------------------------------- /docs/docs/reference/controllers/init_patch/index.md: -------------------------------------------------------------------------------- 1 | # controllers/init\_patch 2 | -------------------------------------------------------------------------------- /release.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/wa-automate-nodejs/HEAD/release.png -------------------------------------------------------------------------------- /docs/docs/concepts/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Concepts", 3 | "position": 1 4 | } 5 | -------------------------------------------------------------------------------- /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = "test-coverage" 5 | enabled = true 6 | -------------------------------------------------------------------------------- /docs/docs/configuration/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Configuration", 3 | "position": 2 4 | } 5 | -------------------------------------------------------------------------------- /docs/docs/get-started/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Get Started", 3 | "position": 1 4 | } 5 | -------------------------------------------------------------------------------- /docs/docs/reference/controllers/initializer/variables/pkg.md: -------------------------------------------------------------------------------- 1 | # Variable: pkg 2 | 3 | > `const` **pkg**: `any` 4 | -------------------------------------------------------------------------------- /docs/static/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/wa-automate-nodejs/HEAD/docs/static/img/logo.png -------------------------------------------------------------------------------- /resources/hotfix-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/wa-automate-nodejs/HEAD/resources/hotfix-logo.png -------------------------------------------------------------------------------- /resources/membership.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/wa-automate-nodejs/HEAD/resources/membership.png -------------------------------------------------------------------------------- /docs/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /docs/docs/reference/api/Client/variables/useragent.md: -------------------------------------------------------------------------------- 1 | # Variable: useragent 2 | 3 | > `const` **useragent**: `string` 4 | -------------------------------------------------------------------------------- /docs/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/wa-automate-nodejs/HEAD/docs/static/img/favicon.ico -------------------------------------------------------------------------------- /src/api/model/id.ts: -------------------------------------------------------------------------------- 1 | export interface Id { 2 | server: string; 3 | user: string; 4 | _serialized: string; 5 | } 6 | -------------------------------------------------------------------------------- /docs/docs/reference/controllers/initializer/variables/screenshot.md: -------------------------------------------------------------------------------- 1 | # Variable: screenshot 2 | 3 | > **screenshot**: `any` 4 | -------------------------------------------------------------------------------- /docs/static/img/docusaurus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/wa-automate-nodejs/HEAD/docs/static/img/docusaurus.png -------------------------------------------------------------------------------- /docs/static/img/license-identifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/wa-automate-nodejs/HEAD/docs/static/img/license-identifier.png -------------------------------------------------------------------------------- /docs/docs/reference/controllers/initializer/variables/configWithCases.md: -------------------------------------------------------------------------------- 1 | # Variable: configWithCases 2 | 3 | > `const` **configWithCases**: `any` 4 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/interfaces/QuoteMap.md: -------------------------------------------------------------------------------- 1 | # Interface: QuoteMap 2 | 3 | ## Indexable 4 | 5 | \[`messageId`: `string`\]: `object` 6 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/id/index.md: -------------------------------------------------------------------------------- 1 | # api/model/id 2 | 3 | ## Index 4 | 5 | ### Interfaces 6 | 7 | - [Id](/reference/api/model/id/interfaces/Id.md) 8 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Dialog/interfaces/CurrentDialogProps.md: -------------------------------------------------------------------------------- 1 | # Interface: CurrentDialogProps 2 | 3 | ## Indexable 4 | 5 | \[`k`: `string`\]: `any` 6 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/label/index.md: -------------------------------------------------------------------------------- 1 | # api/model/label 2 | 3 | ## Index 4 | 5 | ### Interfaces 6 | 7 | - [Label](/reference/api/model/label/interfaces/Label.md) 8 | -------------------------------------------------------------------------------- /docs/docs/reference/controllers/events/index.md: -------------------------------------------------------------------------------- 1 | # controllers/events 2 | 3 | ## Index 4 | 5 | ### Variables 6 | 7 | - [ev](/reference/controllers/events/variables/ev.md) 8 | -------------------------------------------------------------------------------- /docs/src/pages/markdown-page.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Markdown page example 3 | --- 4 | 5 | # Markdown page example 6 | 7 | You don't need React to write simple standalone pages. 8 | -------------------------------------------------------------------------------- /docs/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/miracleflow/wa-automate-nodejs/HEAD/docs/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/ChatServer.md: -------------------------------------------------------------------------------- 1 | # Type Alias: ChatServer 2 | 3 | > **ChatServer**: `"c.us"` 4 | 5 | The suffix used to identify a non-group chat id 6 | -------------------------------------------------------------------------------- /src/lib/README.md: -------------------------------------------------------------------------------- 1 | ## Files here should not be touched. 2 | 3 | --- 4 | 5 | Files inside this directory are automatically generated and copied into dist bundle with the build scripts 6 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/GetURL.md: -------------------------------------------------------------------------------- 1 | # Type Alias: GetURL 2 | 3 | > **GetURL**: `Brand`\<`string`, `"GetURL"`\> 4 | 5 | A URL of a file used with a GET request 6 | -------------------------------------------------------------------------------- /docs/src/theme/DocRoot/Layout/styles.module.css: -------------------------------------------------------------------------------- 1 | .docRoot { 2 | display: flex; 3 | width: 100%; 4 | } 5 | 6 | .docsWrapper { 7 | display: flex; 8 | flex: 1 0 auto; 9 | } 10 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/GroupChatServer.md: -------------------------------------------------------------------------------- 1 | # Type Alias: GroupChatServer 2 | 3 | > **GroupChatServer**: `"g.us"` 4 | 5 | The suffix used to identify a group chat id 6 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/events/index.md: -------------------------------------------------------------------------------- 1 | # api/model/events 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [SimpleListener](/reference/api/model/events/enumerations/SimpleListener.md) 8 | -------------------------------------------------------------------------------- /docs/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)) 6 | } 7 | -------------------------------------------------------------------------------- /docs/docs/reference/api/functions/exposed.enum/index.md: -------------------------------------------------------------------------------- 1 | # api/functions/exposed.enum 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [ExposedFn](/reference/api/functions/exposed.enum/enumerations/ExposedFn.md) 8 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/button/interfaces/Button.md: -------------------------------------------------------------------------------- 1 | # Interface: Button 2 | 3 | ## Properties 4 | 5 | ### id 6 | 7 | > **id**: `string` 8 | 9 | *** 10 | 11 | ### text 12 | 13 | > **text**: `string` 14 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/MessageCollector/index.md: -------------------------------------------------------------------------------- 1 | # structures/MessageCollector 2 | 3 | ## Index 4 | 5 | ### Classes 6 | 7 | - [MessageCollector](/reference/structures/MessageCollector/classes/MessageCollector.md) 8 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/GroupId.md: -------------------------------------------------------------------------------- 1 | # Type Alias: GroupId 2 | 3 | > **GroupId**: \`$\{number\}@$\{GroupChatServer\}\` 4 | 5 | A new group or community has the format of a random number followed by `@g.us` 6 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/chat/type-aliases/Chat.md: -------------------------------------------------------------------------------- 1 | # Type Alias: Chat 2 | 3 | > **Chat**: [`SingleChat`](/reference/api/model/chat/interfaces/SingleChat.md) \| [`GroupChat`](/reference/api/model/chat/interfaces/GroupChat.md) 4 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/interfaces/PollOption.md: -------------------------------------------------------------------------------- 1 | # Interface: PollOption 2 | 3 | ## Properties 4 | 5 | ### localId 6 | 7 | > **localId**: `number` 8 | 9 | *** 10 | 11 | ### name 12 | 13 | > **name**: `string` 14 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/type-aliases/MessagePinDuration.md: -------------------------------------------------------------------------------- 1 | # Type Alias: MessagePinDuration 2 | 3 | > **MessagePinDuration**: `"FifteenSeconds"` \| `"FiveSeconds"` \| `"OneDay"` \| `"OneMinute"` \| `"SevenDays"` \| `"ThirtyDays"` 4 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Dialog/interfaces/DialogButtons.md: -------------------------------------------------------------------------------- 1 | # Interface: DialogButtons 2 | 3 | ## Properties 4 | 5 | ### label 6 | 7 | > **label**: `string` 8 | 9 | *** 10 | 11 | ### value 12 | 13 | > **value**: `string` 14 | -------------------------------------------------------------------------------- /docs/src/components/HomepageFeatures/styles.module.css: -------------------------------------------------------------------------------- 1 | .features { 2 | display: flex; 3 | align-items: center; 4 | padding: 2rem 0; 5 | width: 100%; 6 | } 7 | 8 | .featureSvg { 9 | height: 200px; 10 | width: 200px; 11 | } 12 | -------------------------------------------------------------------------------- /docs/docs/configuration/command-line-options.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: EASY API CLI options 3 | description: Command-line options reference documentation. 4 | sidebar_position: 1 5 | --- 6 | 7 | 8 | 9 | ## Options 10 | 11 | |@|cliOptionsTable|@| 12 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/chat/type-aliases/EphemeralDuration.md: -------------------------------------------------------------------------------- 1 | # Type Alias: EphemeralDuration 2 | 3 | > **EphemeralDuration**: `86400` \| `604800` \| `7776000` 4 | 5 | Ephemeral duration can be 1 day, 7 days or 90 days. The default is 1 day. 6 | -------------------------------------------------------------------------------- /docs/docs/reference/controllers/initializer/functions/timeout.md: -------------------------------------------------------------------------------- 1 | # Function: timeout() 2 | 3 | > **timeout**(`ms`): `Promise`\<`string`\> 4 | 5 | ## Parameters 6 | 7 | • **ms**: `number` 8 | 9 | ## Returns 10 | 11 | `Promise`\<`string`\> 12 | -------------------------------------------------------------------------------- /src/api/functions/exposed.enum.ts: -------------------------------------------------------------------------------- 1 | export enum ExposedFn { 2 | OnMessage = 'onMessage', 3 | OnAnyMessage = 'onAnyMessage', 4 | onAck = 'onAck', 5 | onParticipantsChanged = 'onParticipantsChanged', 6 | onStateChanged = 'onStateChanged', 7 | } 8 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/Content.md: -------------------------------------------------------------------------------- 1 | # Type Alias: Content 2 | 3 | > **Content**: `Brand`\<`string`, `"Content"`\> 4 | 5 | This is a generic type alias for the content of a message 6 | 7 | Example: 8 | 9 | `"hello!"` 10 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/FilePath.md: -------------------------------------------------------------------------------- 1 | # Type Alias: FilePath 2 | 3 | > **FilePath**: `Brand`\<`string`, `"FilePath"`\> 4 | 5 | The relative or absolute path of a file 6 | 7 | Learn more here: https://www.w3schools.com/html/html_filepaths.asp 8 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/group-metadata/enumerations/groupChangeEvent.md: -------------------------------------------------------------------------------- 1 | # Enumeration: groupChangeEvent 2 | 3 | ## Enumeration Members 4 | 5 | ### add 6 | 7 | > **add**: `"add"` 8 | 9 | *** 10 | 11 | ### remove 12 | 13 | > **remove**: `"remove"` 14 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/media/variables/defaultProcessOptions.md: -------------------------------------------------------------------------------- 1 | # Variable: defaultProcessOptions 2 | 3 | > `const` **defaultProcessOptions**: [`Mp4StickerConversionProcessOptions`](/reference/api/model/media/type-aliases/Mp4StickerConversionProcessOptions.md) 4 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/contact/interfaces/BizCategory.md: -------------------------------------------------------------------------------- 1 | # Interface: BizCategory 2 | 3 | ## Properties 4 | 5 | ### id 6 | 7 | > **id**: `string` 8 | 9 | *** 10 | 11 | ### localized\_display\_name 12 | 13 | > **localized\_display\_name**: `string` 14 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/button/interfaces/Section.md: -------------------------------------------------------------------------------- 1 | # Interface: Section 2 | 3 | ## Properties 4 | 5 | ### rows 6 | 7 | > **rows**: [`Row`](/reference/api/model/button/interfaces/Row.md)[] 8 | 9 | *** 10 | 11 | ### title 12 | 13 | > **title**: `string` 14 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/call/index.md: -------------------------------------------------------------------------------- 1 | # api/model/call 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [CallState](/reference/api/model/call/enumerations/CallState.md) 8 | 9 | ### Interfaces 10 | 11 | - [Call](/reference/api/model/call/interfaces/Call.md) 12 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/sessionInfo/index.md: -------------------------------------------------------------------------------- 1 | # api/model/sessionInfo 2 | 3 | ## Index 4 | 5 | ### Interfaces 6 | 7 | - [HealthCheck](/reference/api/model/sessionInfo/interfaces/HealthCheck.md) 8 | - [SessionInfo](/reference/api/model/sessionInfo/interfaces/SessionInfo.md) 9 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/type-aliases/EasyApiResponse.md: -------------------------------------------------------------------------------- 1 | # Type Alias: EasyApiResponse 2 | 3 | > **EasyApiResponse**: `object` 4 | 5 | ## Type declaration 6 | 7 | ### response 8 | 9 | > **response**: `any` 10 | 11 | ### success 12 | 13 | > **success**: `boolean` 14 | -------------------------------------------------------------------------------- /docs/docs/reference/logging/logging/functions/addRotateFileLogTransport.md: -------------------------------------------------------------------------------- 1 | # Function: addRotateFileLogTransport() 2 | 3 | > **addRotateFileLogTransport**(`options`): `void` 4 | 5 | ## Parameters 6 | 7 | • **options**: `any` = `{}` 8 | 9 | ## Returns 10 | 11 | `void` 12 | -------------------------------------------------------------------------------- /docs/docs/how-to/create-api.md: -------------------------------------------------------------------------------- 1 | # Creating an API 2 | 3 | There are multiple convinient ways to create an API. 4 | 5 | 1. Use the ready-made API via npx 6 | 7 | Learn more here [[Easy API]] 8 | 9 | 2. Build your own API on express and just use the built in middleware 10 | 11 | 3. -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/interfaces/DevTools.md: -------------------------------------------------------------------------------- 1 | # Interface: DevTools 2 | 3 | ## Properties 4 | 5 | ### pass 6 | 7 | > **pass**: `string` 8 | 9 | Password for devtools 10 | 11 | *** 12 | 13 | ### user 14 | 15 | > **user**: `string` 16 | 17 | Username for devtools 18 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/id/interfaces/Id.md: -------------------------------------------------------------------------------- 1 | # Interface: Id 2 | 3 | ## Properties 4 | 5 | ### \_serialized 6 | 7 | > **\_serialized**: `string` 8 | 9 | *** 10 | 11 | ### server 12 | 13 | > **server**: `string` 14 | 15 | *** 16 | 17 | ### user 18 | 19 | > **user**: `string` 20 | -------------------------------------------------------------------------------- /docs/docs/reference/logging/custom_transport/index.md: -------------------------------------------------------------------------------- 1 | # logging/custom\_transport 2 | 3 | ## Index 4 | 5 | ### Classes 6 | 7 | - [LogToEvTransport](/reference/logging/custom_transport/classes/LogToEvTransport.md) 8 | - [NoOpTransport](/reference/logging/custom_transport/classes/NoOpTransport.md) 9 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/button/interfaces/Row.md: -------------------------------------------------------------------------------- 1 | # Interface: Row 2 | 3 | ## Properties 4 | 5 | ### description 6 | 7 | > **description**: `string` 8 | 9 | *** 10 | 11 | ### rowId 12 | 13 | > **rowId**: `string` 14 | 15 | *** 16 | 17 | ### title 18 | 19 | > **title**: `string` 20 | -------------------------------------------------------------------------------- /types-only/README.md: -------------------------------------------------------------------------------- 1 | # @open-wa/wa-automate-types-only 2 | 3 | You are most likely looking for [@open-wa/wa-automate](https://www.npmjs.com/package/@open-wa/wa-automate). This package is identical to [@open-wa/wa-automate](https://www.npmjs.com/package/@open-wa/wa-automate) but only contains it's types. 4 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/button/interfaces/LocationButtonBody.md: -------------------------------------------------------------------------------- 1 | # Interface: LocationButtonBody 2 | 3 | ## Properties 4 | 5 | ### caption 6 | 7 | > **caption**: `string` 8 | 9 | *** 10 | 11 | ### lat 12 | 13 | > **lat**: `number` 14 | 15 | *** 16 | 17 | ### lng 18 | 19 | > **lng**: `number` 20 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/contact/interfaces/BizProfileOptions.md: -------------------------------------------------------------------------------- 1 | # Interface: BizProfileOptions 2 | 3 | ## Properties 4 | 5 | ### cartEnabled 6 | 7 | > **cartEnabled**: `boolean` 8 | 9 | *** 10 | 11 | ### commerceExperience 12 | 13 | > **commerceExperience**: `"catalog"` \| `"none"` \| `"shop"` 14 | -------------------------------------------------------------------------------- /docs/docs/reference/controllers/patch_manager/functions/earlyInjectionCheck.md: -------------------------------------------------------------------------------- 1 | # Function: earlyInjectionCheck() 2 | 3 | > **earlyInjectionCheck**(`page`): `Promise`\<(`page`) => `boolean`\> 4 | 5 | ## Parameters 6 | 7 | • **page**: `Page` 8 | 9 | ## Returns 10 | 11 | `Promise`\<(`page`) => `boolean`\> 12 | -------------------------------------------------------------------------------- /docs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // This file is not used in compilation. It is here just for a nice editor experience. 3 | "extends": "@docusaurus/tsconfig", 4 | "compilerOptions": { 5 | "baseUrl": ".", 6 | "paths": { 7 | "@/*": ["./src/*"], 8 | "@site/*": ["./*"] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/WaServers.md: -------------------------------------------------------------------------------- 1 | # Type Alias: WaServers 2 | 3 | > **WaServers**: [`ChatServer`](/reference/api/model/aliases/type-aliases/ChatServer.md) \| [`GroupChatServer`](/reference/api/model/aliases/type-aliases/GroupChatServer.md) 4 | 5 | A type alias for all available "servers" 6 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/type-aliases/AdvancedConfig.md: -------------------------------------------------------------------------------- 1 | # Type Alias: AdvancedConfig 2 | 3 | > **AdvancedConfig**: [`ConfigObject`](/reference/api/model/config/interfaces/ConfigObject.md) & `object` 4 | 5 | ## Type declaration 6 | 7 | ### licenseKey 8 | 9 | > **licenseKey**: `LicenseKeyConfig` 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: Urgent Support 3 | about: Stuck? Need an issue resolved ASAP? Book a 15 min support session. 4 | url: https://cal.com/smashah/15min 5 | - name: Discord 6 | about: Have a quick question? Ask in the community discord. 7 | url: https://discord.gg/dnpp72a -------------------------------------------------------------------------------- /docs/docs/reference/controllers/patch_manager/index.md: -------------------------------------------------------------------------------- 1 | # controllers/patch\_manager 2 | 3 | ## Index 4 | 5 | ### Functions 6 | 7 | - [earlyInjectionCheck](/reference/controllers/patch_manager/functions/earlyInjectionCheck.md) 8 | - [getAndInjectLicense](/reference/controllers/patch_manager/functions/getAndInjectLicense.md) 9 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Dialog/enumerations/ValidationType.md: -------------------------------------------------------------------------------- 1 | # Enumeration: ValidationType 2 | 3 | ## Enumeration Members 4 | 5 | ### CHECK 6 | 7 | > **CHECK**: `"check"` 8 | 9 | *** 10 | 11 | ### LENGTH 12 | 13 | > **LENGTH**: `"length"` 14 | 15 | *** 16 | 17 | ### REGEX 18 | 19 | > **REGEX**: `"regex"` 20 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Dialog/interfaces/DialogListMessageRow.md: -------------------------------------------------------------------------------- 1 | # Interface: DialogListMessageRow 2 | 3 | ## Properties 4 | 5 | ### description 6 | 7 | > **description**: `string` 8 | 9 | *** 10 | 11 | ### title 12 | 13 | > **title**: `string` 14 | 15 | *** 16 | 17 | ### value 18 | 19 | > **value**: `string` 20 | -------------------------------------------------------------------------------- /docs/src/components/License/index.tsx: -------------------------------------------------------------------------------- 1 | export const GetLicenseNavBarButton = () => { 2 | return ( 3 | { 4 | if(window.posthog) window.posthog.capture('click_checkout'); 5 | }} href="https://gum.co/BTMt?tier=1%20Restricted%20License">Get License 6 | ) 7 | } -------------------------------------------------------------------------------- /docs/docs/concepts/how-it-works.md: -------------------------------------------------------------------------------- 1 | # How does this work? 2 | 3 | wa-automate works by automating a chrome/chromium browser process, injecting some code into the web page and exposing functionality through the "Client". Think of it like a robot sitting in front of your whatsapp web and you're controlling that robot with an API or via code. 4 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/chat/enumerations/ChatTypes.md: -------------------------------------------------------------------------------- 1 | # Enumeration: ChatTypes 2 | 3 | Chat types 4 | 5 | ## Enumeration Members 6 | 7 | ### GROUP 8 | 9 | > **GROUP**: `"group"` 10 | 11 | *** 12 | 13 | ### SOLO 14 | 15 | > **SOLO**: `"solo"` 16 | 17 | *** 18 | 19 | ### UNKNOWN 20 | 21 | > **UNKNOWN**: `"unknown"` 22 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/enumerations/Status.md: -------------------------------------------------------------------------------- 1 | # Enumeration: Status 2 | 3 | Client status 4 | 5 | ## Enumeration Members 6 | 7 | ### AUTHENTICATING 8 | 9 | > **AUTHENTICATING**: `1` 10 | 11 | *** 12 | 13 | ### INITIALIZING 14 | 15 | > **INITIALIZING**: `0` 16 | 17 | *** 18 | 19 | ### READY 20 | 21 | > **READY**: `3` 22 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Dialog/interfaces/DialogListMessageSection.md: -------------------------------------------------------------------------------- 1 | # Interface: DialogListMessageSection 2 | 3 | ## Properties 4 | 5 | ### rows 6 | 7 | > **rows**: [`DialogListMessageRow`](/reference/structures/Dialog/interfaces/DialogListMessageRow.md)[] 8 | 9 | *** 10 | 11 | ### title 12 | 13 | > **title**: `string` 14 | -------------------------------------------------------------------------------- /docs/docs/how-to/incoming-calls.md: -------------------------------------------------------------------------------- 1 | # Handle Incoming Call 2 | 3 | [[onIncomingCall]] emits a [[Call]] object. You can use this to tell people not to call the number 4 | 5 | ```javascript 6 | client.onIncomingCall(async call=>{ 7 | await client.sendText(call.peerJid._serialized, 'Sorry I cannot accept calls'); 8 | }); 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/enumerations/QRFormat.md: -------------------------------------------------------------------------------- 1 | # Enumeration: QRFormat 2 | 3 | The different types of qr code output. 4 | 5 | ## Enumeration Members 6 | 7 | ### JPEG 8 | 9 | > **JPEG**: `"jpeg"` 10 | 11 | *** 12 | 13 | ### PNG 14 | 15 | > **PNG**: `"png"` 16 | 17 | *** 18 | 19 | ### WEBM 20 | 21 | > **WEBM**: `"webm"` 22 | -------------------------------------------------------------------------------- /docs/docs/reference/api/Client/index.md: -------------------------------------------------------------------------------- 1 | # api/Client 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [namespace](/reference/api/Client/enumerations/namespace.md) 8 | 9 | ### Classes 10 | 11 | - [Client](/reference/api/Client/classes/Client.md) 12 | 13 | ### Variables 14 | 15 | - [useragent](/reference/api/Client/variables/useragent.md) 16 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/AccountNumber.md: -------------------------------------------------------------------------------- 1 | # Type Alias: AccountNumber 2 | 3 | > **AccountNumber**: \`$\{number\}\` 4 | 5 | The account number. It is made up of a country code and then the local number without the preceeding 0. For example, if a UK (+44) wa account is linked to the number 07123456789 then the account number will be 447123456789. 6 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/MessageId.md: -------------------------------------------------------------------------------- 1 | # Type Alias: MessageId 2 | 3 | > **MessageId**: `Brand`\<\`$\{boolean\}\_$\{ChatId\}\_$\{string\}\`, `"MessageId"`\> 4 | 5 | The id of a message. The format is `[boolean]_[ChatId]_[random character string]` 6 | 7 | Example: 8 | 9 | `"false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB"` 10 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/reactions/index.md: -------------------------------------------------------------------------------- 1 | # api/model/reactions 2 | 3 | ## Index 4 | 5 | ### Type Aliases 6 | 7 | - [Reaction](/reference/api/model/reactions/type-aliases/Reaction.md) 8 | - [ReactionEvent](/reference/api/model/reactions/type-aliases/ReactionEvent.md) 9 | - [ReactionRecord](/reference/api/model/reactions/type-aliases/ReactionRecord.md) 10 | -------------------------------------------------------------------------------- /src/utils/pid_utils.ts: -------------------------------------------------------------------------------- 1 | import pidtree from 'pidtree' 2 | import pidusage from 'pidusage' 3 | 4 | export const pidTreeUsage = async pid => { 5 | if(!Array.isArray(pid)) { 6 | pid = [pid] 7 | } 8 | const pids : number[] = (await Promise.all(pid.map(pidtree))).flat() as number[]; 9 | const stats = await pidusage(pids) 10 | return stats; 11 | } -------------------------------------------------------------------------------- /prebuild.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copies assets needed into dist directory. 3 | * Should be executed after build. 4 | * 5 | * Used in development only. 6 | */ 7 | 8 | import * as shell from 'shelljs'; 9 | 10 | shell.cp('-R', './src/lib', 'dist'); 11 | // shell.cp('./src/api/Client.ts', 'dist/api/_client_ts'); 12 | shell.cp('./src/controllers/popup/index.html', 'dist/controllers/popup/index.html'); -------------------------------------------------------------------------------- /docs/docs/reference/api/Client/enumerations/namespace.md: -------------------------------------------------------------------------------- 1 | # Enumeration: namespace 2 | 3 | ## Enumeration Members 4 | 5 | ### Chat 6 | 7 | > **Chat**: `"Chat"` 8 | 9 | *** 10 | 11 | ### Contact 12 | 13 | > **Contact**: `"Contact"` 14 | 15 | *** 16 | 17 | ### GroupMetadata 18 | 19 | > **GroupMetadata**: `"GroupMetadata"` 20 | 21 | *** 22 | 23 | ### Msg 24 | 25 | > **Msg**: `"Msg"` 26 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/button/interfaces/AdvancedButton.md: -------------------------------------------------------------------------------- 1 | # Interface: AdvancedButton 2 | 3 | ## Properties 4 | 5 | ### id? 6 | 7 | > `optional` **id**: `string` 8 | 9 | *** 10 | 11 | ### number? 12 | 13 | > `optional` **number**: `string` 14 | 15 | *** 16 | 17 | ### text 18 | 19 | > **text**: `string` 20 | 21 | *** 22 | 23 | ### url? 24 | 25 | > `optional` **url**: `string` 26 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/product/index.md: -------------------------------------------------------------------------------- 1 | # api/model/product 2 | 3 | ## Index 4 | 5 | ### Interfaces 6 | 7 | - [CartItem](/reference/api/model/product/interfaces/CartItem.md) 8 | - [CustomProduct](/reference/api/model/product/interfaces/CustomProduct.md) 9 | - [Order](/reference/api/model/product/interfaces/Order.md) 10 | - [Product](/reference/api/model/product/interfaces/Product.md) 11 | -------------------------------------------------------------------------------- /docfix.ts: -------------------------------------------------------------------------------- 1 | import * as shell from 'shelljs'; 2 | 3 | // shell.cp('./node_modules/typedoc-plugin-pages/dist/theme/v2/templates/markdown-page.hbs', './node_modules/typedoc-neo-theme/bin/default/templates'); 4 | shell.cp('./docs-source/layouts/default.hbs', './node_modules/typedoc-plugin-pages/dist/theme/v2/layouts'); 5 | shell.cp('./docs-source/layouts/type.hbs', './node_modules/typedoc-plugin-pages/dist/theme/v2/partials'); -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/AdvancedFile.md: -------------------------------------------------------------------------------- 1 | # Type Alias: AdvancedFile 2 | 3 | > **AdvancedFile**: [`DataURL`](/reference/api/model/aliases/type-aliases/DataURL.md) \| [`FilePath`](/reference/api/model/aliases/type-aliases/FilePath.md) \| [`GetURL`](/reference/api/model/aliases/type-aliases/GetURL.md) 4 | 5 | Some file based actions in open-wa are powerful enough to take a dataurl, url or filepath 6 | -------------------------------------------------------------------------------- /docs/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": false, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.js", 8 | "css": "src/css/custom.css", 9 | "baseColor": "slate", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/.", 15 | "utils": "@/lib/utils" 16 | } 17 | } -------------------------------------------------------------------------------- /docs/docs/reference/logging/logging/index.md: -------------------------------------------------------------------------------- 1 | # logging/logging 2 | 3 | ## Index 4 | 5 | ### Type Aliases 6 | 7 | - [ConfigLogTransport](/reference/logging/logging/type-aliases/ConfigLogTransport.md) 8 | 9 | ### Variables 10 | 11 | - [log](/reference/logging/logging/variables/log.md) 12 | 13 | ### Functions 14 | 15 | - [addRotateFileLogTransport](/reference/logging/logging/functions/addRotateFileLogTransport.md) 16 | -------------------------------------------------------------------------------- /docs/blog/tags.yml: -------------------------------------------------------------------------------- 1 | facebook: 2 | label: Facebook 3 | permalink: /facebook 4 | description: Facebook tag description 5 | hello: 6 | label: Hello 7 | permalink: /hello 8 | description: Hello tag description 9 | docusaurus: 10 | label: Docusaurus 11 | permalink: /docusaurus 12 | description: Docusaurus tag description 13 | hola: 14 | label: Hola 15 | permalink: /hola 16 | description: Hola tag description 17 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/ChatId.md: -------------------------------------------------------------------------------- 1 | # Type Alias: ChatId 2 | 3 | > **ChatId**: [`ContactId`](/reference/api/model/aliases/type-aliases/ContactId.md) \| [`GroupChatId`](/reference/api/model/aliases/type-aliases/GroupChatId.md) 4 | 5 | A chat id ends with `@c.us` or `@g.us` for group chats. 6 | 7 | Example: 8 | 9 | A group chat: `"447123456789-1445627445@g.us"` 10 | A group chat: `"447123456789@g.us"` 11 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Collector/type-aliases/CollectorFilter.md: -------------------------------------------------------------------------------- 1 | # Type Alias: CollectorFilter()\ 2 | 3 | > **CollectorFilter**\<`T`\>: (...`args`) => `boolean` \| `Promise`\<`boolean`\> 4 | 5 | ## Type Parameters 6 | 7 | • **T** *extends* `any`[] 8 | 9 | ## Parameters 10 | 11 | • ...**args**: `T` 12 | 13 | Any arguments received by the listener 14 | 15 | ## Returns 16 | 17 | `boolean` \| `Promise`\<`boolean`\> 18 | -------------------------------------------------------------------------------- /docs/docs/how-to/receive-messages.md: -------------------------------------------------------------------------------- 1 | # Receiving Messages 2 | 3 | ## Listen to only incoming messages 4 | 5 | [[onMessage]] 6 | 7 | ```javascript 8 | client.onMessage(message=>{ 9 | console.log(message.body); 10 | }) 11 | ``` 12 | 13 | ## Listen to all messages in and out 14 | 15 | [[onAnyMessage]] 16 | 17 | ```javascript 18 | client.onAnyMessage(message=>{ 19 | console.log(message.body); 20 | }) 21 | ``` -------------------------------------------------------------------------------- /docs/docs/reference/api/model/media/index.md: -------------------------------------------------------------------------------- 1 | # api/model/media 2 | 3 | ## Index 4 | 5 | ### Type Aliases 6 | 7 | - [Mp4StickerConversionProcessOptions](/reference/api/model/media/type-aliases/Mp4StickerConversionProcessOptions.md) 8 | - [StickerMetadata](/reference/api/model/media/type-aliases/StickerMetadata.md) 9 | 10 | ### Variables 11 | 12 | - [defaultProcessOptions](/reference/api/model/media/variables/defaultProcessOptions.md) 13 | -------------------------------------------------------------------------------- /docs/src/theme/Admonition/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Admonition from '@theme-original/Admonition'; 3 | 4 | export default function AdmonitionWrapper(props) { 5 | console.log("🚀 ~ AdmonitionWrapper ~ props:", props.type) 6 | if (props.type == 'license') { 7 | return ; 8 | } 9 | 10 | return ( 11 | <> 12 | 13 | 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/ContactId.md: -------------------------------------------------------------------------------- 1 | # Type Alias: ContactId 2 | 3 | > **ContactId**: `Brand`\<\`$\{AccountNumber\}@$\{ChatServer\}\`, `"ContactId"`\> 4 | 5 | A contact id ends with `@c.us` and only contains the number of the contact. For example, if the country code of a contact is `44` and their number is `7123456789` then the contact id would be `447123456789@c.us` 6 | 7 | Example: 8 | 9 | `"447123456789@c.us"` 10 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/interfaces/SessionData.md: -------------------------------------------------------------------------------- 1 | # Interface: SessionData 2 | 3 | ## Properties 4 | 5 | ### WABrowserId? 6 | 7 | > `optional` **WABrowserId**: `string` 8 | 9 | *** 10 | 11 | ### WASecretBundle? 12 | 13 | > `optional` **WASecretBundle**: `string` 14 | 15 | *** 16 | 17 | ### WAToken1? 18 | 19 | > `optional` **WAToken1**: `string` 20 | 21 | *** 22 | 23 | ### WAToken2? 24 | 25 | > `optional` **WAToken2**: `string` 26 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/label/interfaces/Label.md: -------------------------------------------------------------------------------- 1 | # Interface: Label 2 | 3 | ## Properties 4 | 5 | ### id 6 | 7 | > **id**: `string` 8 | 9 | The internal ID of the label. Usually a number represented as a string e.g "1" 10 | 11 | *** 12 | 13 | ### items 14 | 15 | > **items**: `object`[] 16 | 17 | The items that are tagged with this label 18 | 19 | *** 20 | 21 | ### name 22 | 23 | > **name**: `string` 24 | 25 | The text contents of the label 26 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/interfaces/MessageInfoInteraction.md: -------------------------------------------------------------------------------- 1 | # Interface: MessageInfoInteraction 2 | 3 | ## Properties 4 | 5 | ### id 6 | 7 | > **id**: [`ContactId`](/reference/api/model/aliases/type-aliases/ContactId.md) 8 | 9 | The contact ID of the contact that interacted with the message. 10 | 11 | *** 12 | 13 | ### t 14 | 15 | > **t**: `number` 16 | 17 | The timestamp of the interaction. You have to x 1000 to use in a JS Date object. 18 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Dialog/type-aliases/CheckFunction.md: -------------------------------------------------------------------------------- 1 | # Type Alias: CheckFunction() 2 | 3 | > **CheckFunction**: (`lastReceivedMessage`, `currentProps`) => `boolean` 4 | 5 | ## Parameters 6 | 7 | • **lastReceivedMessage**: [`Message`](/reference/api/model/message/interfaces/Message.md) 8 | 9 | • **currentProps**: [`CurrentDialogProps`](/reference/structures/Dialog/interfaces/CurrentDialogProps.md) 10 | 11 | ## Returns 12 | 13 | `boolean` 14 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/button/index.md: -------------------------------------------------------------------------------- 1 | # api/model/button 2 | 3 | ## Index 4 | 5 | ### Interfaces 6 | 7 | - [AdvancedButton](/reference/api/model/button/interfaces/AdvancedButton.md) 8 | - [Button](/reference/api/model/button/interfaces/Button.md) 9 | - [LocationButtonBody](/reference/api/model/button/interfaces/LocationButtonBody.md) 10 | - [Row](/reference/api/model/button/interfaces/Row.md) 11 | - [Section](/reference/api/model/button/interfaces/Section.md) 12 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Dialog/interfaces/DialogValidation.md: -------------------------------------------------------------------------------- 1 | # Interface: DialogValidation 2 | 3 | ## Properties 4 | 5 | ### errorMessage 6 | 7 | > **errorMessage**: `string` 8 | 9 | *** 10 | 11 | ### type 12 | 13 | > **type**: [`ValidationType`](/reference/structures/Dialog/enumerations/ValidationType.md) 14 | 15 | *** 16 | 17 | ### value 18 | 19 | > **value**: `string` \| [`CheckFunction`](/reference/structures/Dialog/type-aliases/CheckFunction.md) 20 | -------------------------------------------------------------------------------- /docs/blog/2019-05-28-first-blog-post.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: first-blog-post 3 | title: First Blog Post 4 | authors: 5 | name: Gao Wei 6 | title: Docusaurus Core Team 7 | url: https://github.com/wgao19 8 | image_url: https://github.com/wgao19.png 9 | tags: [hola, docusaurus] 10 | --- 11 | 12 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet 13 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/group-metadata/interfaces/NewCommunityGroup.md: -------------------------------------------------------------------------------- 1 | # Interface: NewCommunityGroup 2 | 3 | Used when creating a new community with. 4 | 5 | ## Properties 6 | 7 | ### ephemeralDuration? 8 | 9 | > `optional` **ephemeralDuration**: `number` 10 | 11 | *** 12 | 13 | ### icon? 14 | 15 | > `optional` **icon**: [`DataURL`](/reference/api/model/aliases/type-aliases/DataURL.md) 16 | 17 | *** 18 | 19 | ### subject 20 | 21 | > **subject**: `string` 22 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/chat/enumerations/ChatState.md: -------------------------------------------------------------------------------- 1 | # Enumeration: ChatState 2 | 3 | The ChatState represents the state you'd normally see represented under the chat name in the app. 4 | 5 | ## Enumeration Members 6 | 7 | ### PAUSED 8 | 9 | > **PAUSED**: `2` 10 | 11 | `online` 12 | 13 | *** 14 | 15 | ### RECORDING 16 | 17 | > **RECORDING**: `1` 18 | 19 | `recording audio...` 20 | 21 | *** 22 | 23 | ### TYPING 24 | 25 | > **TYPING**: `0` 26 | 27 | `typing...` 28 | -------------------------------------------------------------------------------- /docs/src/pages/index.module.css: -------------------------------------------------------------------------------- 1 | /** 2 | * CSS files with the .module.css suffix will be treated as CSS modules 3 | * and scoped locally. 4 | */ 5 | 6 | .heroBanner { 7 | padding: 4rem 0; 8 | text-align: center; 9 | position: relative; 10 | overflow: hidden; 11 | } 12 | 13 | @media screen and (max-width: 996px) { 14 | .heroBanner { 15 | padding: 2rem; 16 | } 17 | } 18 | 19 | .buttons { 20 | display: flex; 21 | align-items: center; 22 | justify-content: center; 23 | } 24 | -------------------------------------------------------------------------------- /src/controllers/preload.js: -------------------------------------------------------------------------------- 1 | // overwrite the `languages` property to use a custom getter 2 | Object.defineProperty(navigator, "languages", { 3 | get: function() { 4 | return ["en-US", "en"]; 5 | }; 6 | }); 7 | 8 | // overwrite the `plugins` property to use a custom getter 9 | Object.defineProperty(navigator, 'plugins', { 10 | get: function() { 11 | // this just needs to have `length > 0`, but we could mock the plugins too 12 | return [1, 2, 3, 4, 5]; 13 | }, 14 | }); -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/GroupChatId.md: -------------------------------------------------------------------------------- 1 | # Type Alias: GroupChatId 2 | 3 | > **GroupChatId**: \`$\{AccountNumber\}-$\{number\}@$\{GroupChatServer\}\` \| [`GroupId`](/reference/api/model/aliases/type-aliases/GroupId.md) 4 | 5 | A group chat ends with `@g.us` and usually has two parts, the timestamp of when it was created, and the user id of the number that created the group. For example `[creator number]-[timestamp]@g.us` 6 | 7 | Example: 8 | 9 | `"447123456789-1445627445@g.us"` 10 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/chat/enumerations/ChatMuteDuration.md: -------------------------------------------------------------------------------- 1 | # Enumeration: ChatMuteDuration 2 | 3 | Valid durations for muting a chat using [[muteChat]] 4 | 5 | ## Enumeration Members 6 | 7 | ### EIGHT\_HOURS 8 | 9 | > **EIGHT\_HOURS**: `"EIGHT_HOURS"` 10 | 11 | Mutes chat for 8 hours 12 | 13 | *** 14 | 15 | ### FOREVER 16 | 17 | > **FOREVER**: `"FOREVER"` 18 | 19 | Mutes chat forever 20 | 21 | *** 22 | 23 | ### ONE\_WEEK 24 | 25 | > **ONE\_WEEK**: `"ONE_WEEK"` 26 | 27 | Mutes chat for 1 week 28 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/enumerations/CLOUD_PROVIDERS.md: -------------------------------------------------------------------------------- 1 | # Enumeration: CLOUD\_PROVIDERS 2 | 3 | ## Enumeration Members 4 | 5 | ### AWS 6 | 7 | > **AWS**: `"AWS"` 8 | 9 | *** 10 | 11 | ### CONTABO 12 | 13 | > **CONTABO**: `"CONTABO"` 14 | 15 | *** 16 | 17 | ### DO 18 | 19 | > **DO**: `"DO"` 20 | 21 | *** 22 | 23 | ### GCP 24 | 25 | > **GCP**: `"GCP"` 26 | 27 | *** 28 | 29 | ### MINIO 30 | 31 | > **MINIO**: `"MINIO"` 32 | 33 | *** 34 | 35 | ### WASABI 36 | 37 | > **WASABI**: `"WASABI"` 38 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/group-metadata/interfaces/Participant.md: -------------------------------------------------------------------------------- 1 | # Interface: Participant 2 | 3 | ## Properties 4 | 5 | ### contact 6 | 7 | > **contact**: [`Contact`](/reference/api/model/contact/interfaces/Contact.md) 8 | 9 | *** 10 | 11 | ### id 12 | 13 | > **id**: [`NonSerializedId`](/reference/api/model/aliases/type-aliases/NonSerializedId.md) 14 | 15 | *** 16 | 17 | ### isAdmin 18 | 19 | > **isAdmin**: `boolean` 20 | 21 | *** 22 | 23 | ### isSuperAdmin 24 | 25 | > **isSuperAdmin**: `boolean` 26 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/Base64.md: -------------------------------------------------------------------------------- 1 | # Type Alias: Base64 2 | 3 | > **Base64**: `Brand`\<`string`, `"Base64"`\> 4 | 5 | Base64 is basically a file encoded as a string. 6 | 7 | Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding. 8 | 9 | Learn more here: https://developer.mozilla.org/en-US/docs/Glossary/Base64 10 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/contact/interfaces/NumberCheck.md: -------------------------------------------------------------------------------- 1 | # Interface: NumberCheck 2 | 3 | ## Properties 4 | 5 | ### canReceiveMessage 6 | 7 | > **canReceiveMessage**: `boolean` 8 | 9 | *** 10 | 11 | ### id 12 | 13 | > **id**: [`Id`](/reference/api/model/id/interfaces/Id.md) 14 | 15 | *** 16 | 17 | ### isBusiness 18 | 19 | > **isBusiness**: `boolean` 20 | 21 | *** 22 | 23 | ### numberExists 24 | 25 | > **numberExists**: `boolean` 26 | 27 | *** 28 | 29 | ### status 30 | 31 | > **status**: `200` \| `404` 32 | -------------------------------------------------------------------------------- /docs/docs/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | position: 0 3 | sidebar_position: 0 4 | title: Introduction 5 | --- 6 | 7 | # Introduction 8 | 9 | open-wa is a collection of tools designed to enable you to easily automate your WhatsApp account. 10 | 11 | There are multiple ways to run this library: 12 | 13 | - CLI (npx/docker) 14 | - [npx](/docs/get-started/quick-run) 15 | - [Docker](/docs/get-started/docker) 16 | 17 | - Your own custom code 18 | - [Locally](/docs/get-started/installation) 19 | - [Socketed](/docs/get-started/socketmode) 20 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/NonSerializedId.md: -------------------------------------------------------------------------------- 1 | # Type Alias: NonSerializedId 2 | 3 | > **NonSerializedId**: `object` 4 | 5 | ## Type declaration 6 | 7 | ### \_serialized 8 | 9 | > **\_serialized**: [`ContactId`](/reference/api/model/aliases/type-aliases/ContactId.md) 10 | 11 | ### server 12 | 13 | > **server**: [`WaServers`](/reference/api/model/aliases/type-aliases/WaServers.md) 14 | 15 | ### user 16 | 17 | > **user**: [`AccountNumber`](/reference/api/model/aliases/type-aliases/AccountNumber.md) 18 | -------------------------------------------------------------------------------- /docs/docs/reference/controllers/initializer/index.md: -------------------------------------------------------------------------------- 1 | # controllers/initializer 2 | 3 | ## Index 4 | 5 | ### Variables 6 | 7 | - [configWithCases](/reference/controllers/initializer/variables/configWithCases.md) 8 | - [pkg](/reference/controllers/initializer/variables/pkg.md) 9 | - [screenshot](/reference/controllers/initializer/variables/screenshot.md) 10 | 11 | ### Functions 12 | 13 | - [create](/reference/controllers/initializer/functions/create.md) 14 | - [timeout](/reference/controllers/initializer/functions/timeout.md) 15 | -------------------------------------------------------------------------------- /docs/blog/authors.yml: -------------------------------------------------------------------------------- 1 | endi: 2 | name: Endilie Yacop Sucipto 3 | title: Maintainer of Docusaurus 4 | url: https://github.com/endiliey 5 | image_url: https://github.com/endiliey.png 6 | 7 | yangshun: 8 | name: Yangshun Tay 9 | title: Front End Engineer @ Facebook 10 | url: https://github.com/yangshun 11 | image_url: https://github.com/yangshun.png 12 | 13 | slorber: 14 | name: Sébastien Lorber 15 | title: Docusaurus maintainer 16 | url: https://sebastienlorber.com 17 | image_url: https://github.com/slorber.png 18 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/preProcessors/variables/MessagePreprocessors.md: -------------------------------------------------------------------------------- 1 | # Variable: MessagePreprocessors 2 | 3 | > `const` **MessagePreprocessors**: `object` 4 | 5 | An object that contains all available [[PREPROCESSORS]]. 6 | 7 | [Check out the processor code here](https://github.com/open-wa/wa-automate-nodejs/blob/master/src/structures/preProcessors.ts) 8 | 9 | ## Index Signature 10 | 11 | \[`processorName`: `string`\]: [`MessagePreProcessor`](/reference/structures/preProcessors/type-aliases/MessagePreProcessor.md) 12 | -------------------------------------------------------------------------------- /src/api/model/button.ts: -------------------------------------------------------------------------------- 1 | export interface Button { 2 | id: string, 3 | text: string 4 | } 5 | export interface AdvancedButton { 6 | id ?: string 7 | text: string 8 | url ?: string 9 | number ?: string 10 | } 11 | 12 | export interface Row { 13 | title: string, 14 | description: string, 15 | rowId: string 16 | } 17 | 18 | export interface Section { 19 | title: string, 20 | rows: Row[] 21 | } 22 | 23 | export interface LocationButtonBody { 24 | lat:number, 25 | lng:number, 26 | caption:string 27 | } -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | # github: [smashah] 4 | # patreon: # Replace with a single Patreon username 5 | # open_collective: # Replace with a single Open Collective username 6 | # ko_fi: smashah 7 | # tidelift: npm/@open-wa/wa-automate 8 | # community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | # liberapay: # Replace with a single Liberapay username 10 | # issuehunt: smashah 11 | # otechie: smashah 12 | custom: ['https://payitfwd.dev/open-wa/wa-automate-nodejs'] 13 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/interfaces/EventPayload.md: -------------------------------------------------------------------------------- 1 | # Interface: EventPayload 2 | 3 | ## Indexable 4 | 5 | \[`k`: `string`\]: `any` 6 | 7 | ## Properties 8 | 9 | ### data 10 | 11 | > **data**: `any` 12 | 13 | *** 14 | 15 | ### event 16 | 17 | > **event**: [`SimpleListener`](/reference/api/model/events/enumerations/SimpleListener.md) 18 | 19 | *** 20 | 21 | ### id 22 | 23 | > **id**: `string` 24 | 25 | *** 26 | 27 | ### sessionId 28 | 29 | > **sessionId**: `string` 30 | 31 | *** 32 | 33 | ### ts 34 | 35 | > **ts**: `number` 36 | -------------------------------------------------------------------------------- /docs/src/theme/DocRoot/Layout/Main/styles.module.css: -------------------------------------------------------------------------------- 1 | .docMainContainer { 2 | display: flex; 3 | width: 100%; 4 | } 5 | 6 | @media (min-width: 997px) { 7 | .docMainContainer { 8 | flex-grow: 1; 9 | max-width: calc(100% - var(--doc-sidebar-width)); 10 | } 11 | 12 | .docMainContainerEnhanced { 13 | max-width: calc(100% - var(--doc-sidebar-hidden-width)); 14 | } 15 | 16 | .docItemWrapperEnhanced { 17 | max-width: calc( 18 | var(--ifm-container-width) + var(--doc-sidebar-width) 19 | ) !important; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /docs/blog/2021-08-01-mdx-blog-post.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | slug: mdx-blog-post 3 | title: MDX Blog Post 4 | authors: [slorber] 5 | tags: [docusaurus] 6 | --- 7 | 8 | Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/markdown-features), such as [MDX](https://mdxjs.com/). 9 | 10 | :::tip 11 | 12 | Use the power of React to create interactive blog posts. 13 | 14 | ```js 15 | 16 | ``` 17 | 18 | 19 | 20 | ::: 21 | -------------------------------------------------------------------------------- /docs/docs/reference/api/functions/exposed.enum/enumerations/ExposedFn.md: -------------------------------------------------------------------------------- 1 | # Enumeration: ExposedFn 2 | 3 | ## Enumeration Members 4 | 5 | ### OnAnyMessage 6 | 7 | > **OnAnyMessage**: `"onAnyMessage"` 8 | 9 | *** 10 | 11 | ### OnMessage 12 | 13 | > **OnMessage**: `"onMessage"` 14 | 15 | *** 16 | 17 | ### onAck 18 | 19 | > **onAck**: `"onAck"` 20 | 21 | *** 22 | 23 | ### onParticipantsChanged 24 | 25 | > **onParticipantsChanged**: `"onParticipantsChanged"` 26 | 27 | *** 28 | 29 | ### onStateChanged 30 | 31 | > **onStateChanged**: `"onStateChanged"` 32 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/enumerations/DIRECTORY_STRATEGY.md: -------------------------------------------------------------------------------- 1 | # Enumeration: DIRECTORY\_STRATEGY 2 | 3 | ## Enumeration Members 4 | 5 | ### CHAT 6 | 7 | > **CHAT**: `"CHAT"` 8 | 9 | E.g `/447123456789/` 10 | 11 | *** 12 | 13 | ### CHAT\_DATE 14 | 15 | > **CHAT\_DATE**: `"CHAT_DATE"` 16 | 17 | E.g `/447123456789/2021-08-16/` 18 | 19 | *** 20 | 21 | ### DATE 22 | 23 | > **DATE**: `"DATE"` 24 | 25 | E.g `/2021-08-16/` 26 | 27 | *** 28 | 29 | ### DATE\_CHAT 30 | 31 | > **DATE\_CHAT**: `"DATE_CHAT"` 32 | 33 | E.g `/2021-08-16/447123456789/` 34 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/preProcessors/index.md: -------------------------------------------------------------------------------- 1 | # structures/preProcessors 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [PREPROCESSORS](/reference/structures/preProcessors/enumerations/PREPROCESSORS.md) 8 | 9 | ### Type Aliases 10 | 11 | - [MPConfigType](/reference/structures/preProcessors/type-aliases/MPConfigType.md) 12 | - [MessagePreProcessor](/reference/structures/preProcessors/type-aliases/MessagePreProcessor.md) 13 | 14 | ### Variables 15 | 16 | - [MessagePreprocessors](/reference/structures/preProcessors/variables/MessagePreprocessors.md) 17 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/enumerations/MessageAck.md: -------------------------------------------------------------------------------- 1 | # Enumeration: MessageAck 2 | 3 | Message ACK 4 | 5 | ## Enumeration Members 6 | 7 | ### ACK\_DEVICE 8 | 9 | > **ACK\_DEVICE**: `2` 10 | 11 | *** 12 | 13 | ### ACK\_ERROR 14 | 15 | > **ACK\_ERROR**: `-1` 16 | 17 | *** 18 | 19 | ### ACK\_PENDING 20 | 21 | > **ACK\_PENDING**: `0` 22 | 23 | *** 24 | 25 | ### ACK\_PLAYED 26 | 27 | > **ACK\_PLAYED**: `4` 28 | 29 | *** 30 | 31 | ### ACK\_READ 32 | 33 | > **ACK\_READ**: `3` 34 | 35 | *** 36 | 37 | ### ACK\_SERVER 38 | 39 | > **ACK\_SERVER**: `1` 40 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/contact/index.md: -------------------------------------------------------------------------------- 1 | # api/model/contact 2 | 3 | ## Index 4 | 5 | ### Interfaces 6 | 7 | - [BizCategory](/reference/api/model/contact/interfaces/BizCategory.md) 8 | - [BizProfileOptions](/reference/api/model/contact/interfaces/BizProfileOptions.md) 9 | - [BusinessHours](/reference/api/model/contact/interfaces/BusinessHours.md) 10 | - [BusinessProfile](/reference/api/model/contact/interfaces/BusinessProfile.md) 11 | - [Contact](/reference/api/model/contact/interfaces/Contact.md) 12 | - [NumberCheck](/reference/api/model/contact/interfaces/NumberCheck.md) 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | session 4 | newsession 5 | **buttons.js 6 | **req.ts 7 | **qr_code_session.png 8 | **.re.js 9 | **.postman_collection.json 10 | **.sw_col.json 11 | tempchangelog.txt 12 | .npmrc 13 | .DS_Store 14 | demo/buttons.js 15 | demo/**.jpeg 16 | demo/**.png 17 | demo/**.mp4 18 | **.ignore.ts 19 | **.ignore** 20 | **_IGNORE_** 21 | **docs-v2** 22 | # **docs-v3** 23 | .vscode/launch.json 24 | **logs** 25 | bin/cli.config.json 26 | 27 | # managed by open-wa 28 | **.data.json 29 | **.node-persist** 30 | # end managed by open-wa 31 | **.log 32 | **.log.gz 33 | **-audit.json -------------------------------------------------------------------------------- /docs/docs/how-to/manage-participants.md: -------------------------------------------------------------------------------- 1 | # Manage Participants 2 | 3 | [[addParticipant]] - add a participant 4 | [[removeParticipant]] - remove a particpant 5 | [[promoteParticipant]] - Make a participant admin 6 | [[demoteParticipant]] - remove participant as admin 7 | 8 | ```javascript 9 | ... 10 | client.addParticipant('XXXXXXX-YYYYYY@c.us','ZZZZZZZZZ@c.us') 11 | client.removeParticipant('XXXXXXX-YYYYYY@c.us','ZZZZZZZZZ@c.us') 12 | client.promoteParticipant('XXXXXXX-YYYYYY@c.us','ZZZZZZZZZ@c.us') 13 | client.demoteParticipant('XXXXXXX-YYYYYY@c.us','ZZZZZZZZZ@c.us') 14 | ... 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Collector/index.md: -------------------------------------------------------------------------------- 1 | # structures/Collector 2 | 3 | ## Index 4 | 5 | ### Classes 6 | 7 | - [Collection](/reference/structures/Collector/classes/Collection.md) 8 | - [Collector](/reference/structures/Collector/classes/Collector.md) 9 | 10 | ### Interfaces 11 | 12 | - [AwaitMessagesOptions](/reference/structures/Collector/interfaces/AwaitMessagesOptions.md) 13 | - [CollectorOptions](/reference/structures/Collector/interfaces/CollectorOptions.md) 14 | 15 | ### Type Aliases 16 | 17 | - [CollectorFilter](/reference/structures/Collector/type-aliases/CollectorFilter.md) 18 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/preProcessors/type-aliases/MPConfigType.md: -------------------------------------------------------------------------------- 1 | # Type Alias: MPConfigType 2 | 3 | > **MPConfigType**: [`PREPROCESSORS`](/reference/structures/preProcessors/enumerations/PREPROCESSORS.md) \| [`MessagePreProcessor`](/reference/structures/preProcessors/type-aliases/MessagePreProcessor.md) \| ([`PREPROCESSORS`](/reference/structures/preProcessors/enumerations/PREPROCESSORS.md) \| [`MessagePreProcessor`](/reference/structures/preProcessors/type-aliases/MessagePreProcessor.md))[] 4 | 5 | The actual type for [config.messagePreprocessor](/docs/api/interfaces/api_model_config.ConfigObject#messagepreprocessor) 6 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/product/interfaces/CartItem.md: -------------------------------------------------------------------------------- 1 | # Interface: CartItem 2 | 3 | ## Properties 4 | 5 | ### id 6 | 7 | > **id**: `string` 8 | 9 | Product ID 10 | 11 | *** 12 | 13 | ### name 14 | 15 | > **name**: `string` 16 | 17 | Product name 18 | 19 | *** 20 | 21 | ### qty 22 | 23 | > **qty**: `number` 24 | 25 | Amount of this item in the cart 26 | 27 | *** 28 | 29 | ### thumbnailId 30 | 31 | > **thumbnailId**: `string` 32 | 33 | *** 34 | 35 | ### thumbnailUrl 36 | 37 | > **thumbnailUrl**: `string` 38 | 39 | URL to .enc file of the thumbnail. Just change the filetype to .jpg to view the thumbnail 40 | -------------------------------------------------------------------------------- /types-only/.npmignore: -------------------------------------------------------------------------------- 1 | tsconfig.json 2 | src 3 | session 4 | assets 5 | demo 6 | docs 7 | resources 8 | .deepsource.toml 9 | .prettierignore 10 | .prettierrc 11 | .release-it.json 12 | CHANGELOG.md 13 | compact-keepchangelog.hbs 14 | prebuild.ts 15 | release-image.js 16 | sandbox.ts 17 | tempchangelog.txt 18 | .github 19 | session 20 | newsession 21 | **req.ts 22 | **qr_code_session.png 23 | **.re.js 24 | release.png 25 | **.data.json 26 | patches.json 27 | _cn 28 | docfix.ts 29 | test 30 | docs-source 31 | cname-fix.ts 32 | compact-keepachangelog.hbs 33 | CHANGELOG.md 34 | **.ignore.** 35 | CHANGELOG_NEW.md 36 | patches 37 | fragments -------------------------------------------------------------------------------- /docs/docs/how-to/detect-logout.md: -------------------------------------------------------------------------------- 1 | # Detecting Logouts 2 | 3 | First use [[onStateChanged]] to detect changes in the session state. Then use [[forceRefocus]] to force the the app to continue working. If `state` equals `UNPAIRED` that means the host account user has manually de authenticated the session through the app. 4 | 5 | ```javascript 6 | 7 | client.onStateChanged(state=>{ 8 | console.log('statechanged', state) 9 | if(state==="CONFLICT" || state==="UNLAUNCHED") client.forceRefocus(); 10 | 11 | if(state==='UNPAIRED') console.log('LOGGED OUT!!!!') 12 | }); 13 | ``` 14 | 15 | For more information see: [[STATE]] 16 | -------------------------------------------------------------------------------- /.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "github": { 3 | "release": true 4 | }, 5 | "hooks": { 6 | "after:bump": "npm run build && npx auto-changelog --ignore-commit-pattern \"🥚.*\" --commit-limit false -p -t keepachangelog && npm run docs && npm run release-image && git status", 7 | "before:git:release": "npm run release-image" 8 | }, 9 | "git": { 10 | "changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs --ignore-commit-pattern \"🥚.*\"" 11 | }, 12 | "npm": { 13 | "timeout": 60000 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/enumerations/NotificationLanguage.md: -------------------------------------------------------------------------------- 1 | # Enumeration: NotificationLanguage 2 | 3 | The available languages for the host security notification 4 | 5 | ## Enumeration Members 6 | 7 | ### DEDE 8 | 9 | > **DEDE**: `"de-de"` 10 | 11 | *** 12 | 13 | ### ENGB 14 | 15 | > **ENGB**: `"en-gb"` 16 | 17 | *** 18 | 19 | ### ES 20 | 21 | > **ES**: `"es"` 22 | 23 | *** 24 | 25 | ### IDID 26 | 27 | > **IDID**: `"id-id"` 28 | 29 | *** 30 | 31 | ### ITIT 32 | 33 | > **ITIT**: `"it-it"` 34 | 35 | *** 36 | 37 | ### NLNL 38 | 39 | > **NLNL**: `"nl-nl"` 40 | 41 | *** 42 | 43 | ### PTBR 44 | 45 | > **PTBR**: `"pt-br"` 46 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/group-metadata/interfaces/ParticipantChangedEventModel.md: -------------------------------------------------------------------------------- 1 | # Interface: ParticipantChangedEventModel 2 | 3 | ## Properties 4 | 5 | ### action 6 | 7 | > **action**: [`groupChangeEvent`](/reference/api/model/group-metadata/enumerations/groupChangeEvent.md) 8 | 9 | *** 10 | 11 | ### by 12 | 13 | > **by**: [`ContactId`](/reference/api/model/aliases/type-aliases/ContactId.md) 14 | 15 | *** 16 | 17 | ### chat 18 | 19 | > **chat**: [`ChatId`](/reference/api/model/aliases/type-aliases/ChatId.md) 20 | 21 | *** 22 | 23 | ### who 24 | 25 | > **who**: [`ContactId`](/reference/api/model/aliases/type-aliases/ContactId.md)[] 26 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/errors/index.md: -------------------------------------------------------------------------------- 1 | # api/model/errors 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [AddParticipantErrorStatusCode](/reference/api/model/errors/enumerations/AddParticipantErrorStatusCode.md) 8 | - [ERROR\_NAME](/reference/api/model/errors/enumerations/ERROR_NAME.md) 9 | 10 | ### Classes 11 | 12 | - [AddParticipantError](/reference/api/model/errors/classes/AddParticipantError.md) 13 | - [CustomError](/reference/api/model/errors/classes/CustomError.md) 14 | - [PageEvaluationTimeout](/reference/api/model/errors/classes/PageEvaluationTimeout.md) 15 | - [SessionExpiredError](/reference/api/model/errors/classes/SessionExpiredError.md) 16 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { Client } from './api/Client'; 2 | import { SimpleListener } from './api/model'; 3 | 4 | export * from './api/model'; 5 | export * from './api/Client'; 6 | export { create } from './controllers/initializer'; 7 | export * from '@open-wa/wa-decrypt'; 8 | export { ev, Spin } from './controllers/events' 9 | export * from './utils/tools' 10 | export * from './logging/logging' 11 | export * from './structures/preProcessors' 12 | export * from '@open-wa/wa-automate-socket-client'; 13 | export { Client, SimpleListener } 14 | //dont need to export this 15 | // export { getConfigWithCase } from './utils/configSchema' 16 | export * from './build/build-postman' -------------------------------------------------------------------------------- /docs/src/theme/Admonition/Types.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import DefaultAdmonitionTypes from '@theme-original/Admonition/Types'; 3 | 4 | function MyCustomAdmonition(props) { 5 | return ( 6 |
7 |
{props.title}
8 |
{props.children}
9 |
10 | ); 11 | } 12 | 13 | const AdmonitionTypes = { 14 | ...DefaultAdmonitionTypes, 15 | // Add all your custom admonition types here... 16 | // You can also override the default ones if you want 17 | 'license': DefaultAdmonitionTypes['note'], 18 | }; 19 | 20 | export default AdmonitionTypes; -------------------------------------------------------------------------------- /docs/docs/configuration/capture-qr.md: -------------------------------------------------------------------------------- 1 | # Capturing QR Code 2 | 3 | An event is emitted every time the QR code is received by the system. You can grab hold of this event emitter by importing [`ev`](/TODO). You can capture this qr code and save it to a file. 4 | 5 | ```javascript 6 | import { ev } from '@open-wa/wa-automate'; 7 | const fs = require('fs'); 8 | 9 | ev.on('qr.**', async qrcode => { 10 | //qrcode is base64 encoded qr code image 11 | //now you can do whatever you want with it 12 | const imageBuffer = Buffer.from( 13 | qrcode.replace('data:image/png;base64,', ''), 14 | 'base64' 15 | ); 16 | fs.writeFileSync('qr_code.png', imageBuffer); 17 | }); 18 | ``` 19 | -------------------------------------------------------------------------------- /docs/docs/configuration/capture-sd.md: -------------------------------------------------------------------------------- 1 | # Capturing the session data 2 | 3 | By default, the session data is saved as a `[sessionId].data.json` file in the process working directory, however, you can disable this ([ConfigObject.skipSessionSave]) and implement a custom handler for session data. It is important that you always update session data with the latest values. The default behaviour is to override the data.json file with the latest session data. 4 | 5 | ```javascript 6 | import { ev } from '@open-wa/wa-automate'; 7 | const fs = require('fs'); 8 | 9 | ev.on('sessionData.**', async (sessionData, sessionId) => { 10 | //do something with sessionData and sessionId 11 | }); 12 | ``` 13 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/chat/interfaces/GroupChatCreationResponse.md: -------------------------------------------------------------------------------- 1 | # Interface: GroupChatCreationResponse 2 | 3 | ## Properties 4 | 5 | ### gid 6 | 7 | > **gid**: [`GroupChatId`](/reference/api/model/aliases/type-aliases/GroupChatId.md) 8 | 9 | The group chat id 10 | 11 | *** 12 | 13 | ### participants 14 | 15 | > **participants**: `object`[] 16 | 17 | The initial requested participants and their corresponding add responses 18 | 19 | *** 20 | 21 | ### status 22 | 23 | > **status**: `200` \| `400` 24 | 25 | The resultant status code of the group chat creation. 26 | 27 | 200 if the group was created successfully. 28 | 29 | 400 if the initial participant does not exist 30 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es2021": true, 4 | "node": true 5 | }, 6 | "extends": [ 7 | "eslint:recommended", 8 | "plugin:@typescript-eslint/recommended" 9 | ], 10 | "parser": "@typescript-eslint/parser", 11 | "parserOptions": { 12 | "ecmaVersion": 12, 13 | "sourceType": "module" 14 | }, 15 | "plugins": [ 16 | "@typescript-eslint" 17 | ], 18 | "rules": { 19 | "@typescript-eslint/no-explicit-any" : "off", 20 | "@typescript-eslint/no-empty-function" : "off", 21 | "no-async-promise-executor" : "off", 22 | "@typescript-eslint/ban-ts-comment" : "off" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /docs/docs/reference/controllers/patch_manager/functions/getAndInjectLicense.md: -------------------------------------------------------------------------------- 1 | # Function: getAndInjectLicense() 2 | 3 | > **getAndInjectLicense**(`page`, `config`, `me`, `debugInfo`, `spinner`?, `preloadedLicense`?): `Promise`\<`boolean`\> 4 | 5 | ## Parameters 6 | 7 | • **page**: `Page` 8 | 9 | • **config**: [`ConfigObject`](/reference/api/model/config/interfaces/ConfigObject.md) 10 | 11 | • **me** 12 | 13 | • **me.\_serialized**: `string` 14 | 15 | • **debugInfo**: [`SessionInfo`](/reference/api/model/sessionInfo/interfaces/SessionInfo.md) 16 | 17 | • **spinner?**: `Spin` 18 | 19 | • **preloadedLicense?**: `string` \| `false` 20 | 21 | ## Returns 22 | 23 | `Promise`\<`boolean`\> 24 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/DataURL.md: -------------------------------------------------------------------------------- 1 | # Type Alias: DataURL 2 | 3 | > **DataURL**: `Brand`\<\`data:$\{string\};base64,$\{Base64\}\`, `"DataURL"`\> 4 | 5 | Data URLs, URLs prefixed with the data: scheme, allow content creators to embed small files inline in documents. They were formerly known as "data URIs" until that name was retired by the WHATWG. 6 | 7 | Data URLs are composed of four parts: a prefix (data:), a MIME type indicating the type of data, an optional base64 token if non-textual, and the data itself: 8 | 9 | Example: 10 | `"data:[][;base64],"` 11 | 12 | Learn more here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs 13 | -------------------------------------------------------------------------------- /.github/workflows/docs-run.yml: -------------------------------------------------------------------------------- 1 | name: Build & Publish Documentation 2 | 3 | on: 4 | release: 5 | types: [published] 6 | workflow_dispatch: 7 | 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | with: 15 | token: ${{ secrets.CUSTOM_GH_TOKEN }} 16 | - run: npm ci 17 | - run: npm run build 18 | - run: npm i 19 | - run: git config --global user.email "github-actions[bot]@users.noreply.github.com" 20 | - run: git config --global user.name "github-actions[bot]" 21 | - run: npm run docs 22 | env: 23 | GIT_USER: smashah 24 | GIT_PASS: ${{ secrets.CUSTOM_GH_TOKEN }} -------------------------------------------------------------------------------- /docs/docs/reference/structures/Dialog/interfaces/DialogTemplate.md: -------------------------------------------------------------------------------- 1 | # Interface: DialogTemplate 2 | 3 | ## Properties 4 | 5 | ### dialogId 6 | 7 | > **dialogId**: `string` 8 | 9 | *** 10 | 11 | ### identifier 12 | 13 | > **identifier**: `string` 14 | 15 | *** 16 | 17 | ### privateOnly 18 | 19 | > **privateOnly**: `boolean` 20 | 21 | *** 22 | 23 | ### properties 24 | 25 | > **properties**: `object` 26 | 27 | #### Index Signature 28 | 29 | \[`key`: `string`\]: [`DialogProperty`](/reference/structures/Dialog/interfaces/DialogProperty.md) 30 | 31 | *** 32 | 33 | ### startMessage 34 | 35 | > **startMessage**: `string` 36 | 37 | *** 38 | 39 | ### successMessage 40 | 41 | > **successMessage**: `string` 42 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/reactions/type-aliases/Reaction.md: -------------------------------------------------------------------------------- 1 | # Type Alias: Reaction 2 | 3 | > **Reaction**: `object` 4 | 5 | A reaction is identified the specific emoji. 6 | 7 | ## Type declaration 8 | 9 | ### aggregateEmoji 10 | 11 | > **aggregateEmoji**: `string` 12 | 13 | The aggregate emoji used for the reaction. 14 | 15 | ### hasReactionByMe 16 | 17 | > **hasReactionByMe**: `boolean` 18 | 19 | If the reaction is also sent by the host account 20 | 21 | ### id 22 | 23 | > **id**: `string` 24 | 25 | The identifier of the reaction 26 | 27 | ### senders 28 | 29 | > **senders**: [`ReactionRecord`](/reference/api/model/reactions/type-aliases/ReactionRecord.md)[] 30 | 31 | The senders of this spefcific reaction 32 | -------------------------------------------------------------------------------- /compact-keepachangelog.hbs: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | {{#each releases}} 4 | {{#if @first}} 5 | {{#if href}} 6 | ## 🚀 Release [{{title}}]({{href}}){{#if tag}} ({{isoDate}}){{/if}} 7 | {{else}} 8 | ## {{title}}{{#if tag}} ({{isoDate}}){{/if}} 9 | {{/if}} 10 | 11 | {{#if summary}} 12 | {{summary}} 13 | {{/if}} 14 | 15 | {{#each merges}} 16 | - {{message}} {{#if href}}[`#{{id}}`]({{href}}){{/if}} 17 | {{/each}} 18 | {{#each fixes}} 19 | - {{commit.subject}}{{#each fixes}} {{#if href}}[`#{{id}}`]({{href}}){{/if}}{{/each}} 20 | {{/each}} 21 | {{#each commits}} 22 | - {{#if breaking}}**Breaking change:** {{/if}}{{subject}} {{#if href}}[`{{shorthash}}`]({{href}}){{/if}} 23 | {{/each}} 24 | {{/if}} 25 | {{/each}} -------------------------------------------------------------------------------- /docs/docs/reference/api/model/chat/interfaces/LiveLocationChangedEvent.md: -------------------------------------------------------------------------------- 1 | # Interface: LiveLocationChangedEvent 2 | 3 | ## Properties 4 | 5 | ### accuracy 6 | 7 | > **accuracy**: `number` 8 | 9 | *** 10 | 11 | ### degrees 12 | 13 | > **degrees**: `any` 14 | 15 | *** 16 | 17 | ### id 18 | 19 | > **id**: `string` 20 | 21 | *** 22 | 23 | ### lastUpdated 24 | 25 | > **lastUpdated**: `number` 26 | 27 | *** 28 | 29 | ### lat 30 | 31 | > **lat**: `number` 32 | 33 | *** 34 | 35 | ### lng 36 | 37 | > **lng**: `number` 38 | 39 | *** 40 | 41 | ### msgId? 42 | 43 | > `optional` **msgId**: `string` 44 | 45 | The message id that was sent when the liveLocation session was started. 46 | 47 | *** 48 | 49 | ### speed 50 | 51 | > **speed**: `number` 52 | -------------------------------------------------------------------------------- /docs/src/theme/DocRoot/Layout/Sidebar/ExpandButton/styles.module.css: -------------------------------------------------------------------------------- 1 | @media (min-width: 997px) { 2 | .expandButton { 3 | position: absolute; 4 | top: 0; 5 | right: 0; 6 | width: 100%; 7 | height: 100%; 8 | display: flex; 9 | align-items: center; 10 | justify-content: center; 11 | transition: background-color var(--ifm-transition-fast) ease; 12 | background-color: var(--docusaurus-collapse-button-bg); 13 | } 14 | 15 | .expandButton:hover, 16 | .expandButton:focus { 17 | background-color: var(--docusaurus-collapse-button-bg-hover); 18 | } 19 | 20 | .expandButtonIcon { 21 | transform: rotate(0); 22 | } 23 | 24 | [dir='rtl'] .expandButtonIcon { 25 | transform: rotate(180deg); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/interfaces/ProxyServerCredentials.md: -------------------------------------------------------------------------------- 1 | # Interface: ProxyServerCredentials 2 | 3 | ## Properties 4 | 5 | ### address 6 | 7 | > **address**: `string` 8 | 9 | Proxy Server address. This can include the port e.g '127.0.0.1:5005' 10 | 11 | *** 12 | 13 | ### password 14 | 15 | > **password**: `string` 16 | 17 | Password for Proxy Server authentication 18 | 19 | *** 20 | 21 | ### protocol? 22 | 23 | > `optional` **protocol**: `string` 24 | 25 | The protocol on which the proxy is running. E.g `http`, `https`, `socks4` or `socks5`. This is optional and can be automatically determined from the address. 26 | 27 | *** 28 | 29 | ### username 30 | 31 | > **username**: `string` 32 | 33 | Username for Proxy Server authentication 34 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/interfaces/PollData.md: -------------------------------------------------------------------------------- 1 | # Interface: PollData 2 | 3 | ## Properties 4 | 5 | ### pollMessage 6 | 7 | > **pollMessage**: [`Message`](/reference/api/model/message/interfaces/Message.md) 8 | 9 | The message object of the poll 10 | 11 | *** 12 | 13 | ### pollOptions 14 | 15 | > **pollOptions**: [`PollOption`](/reference/api/model/message/interfaces/PollOption.md) & `object`[] 16 | 17 | The poll options and their respective count of votes. 18 | 19 | *** 20 | 21 | ### totalVotes 22 | 23 | > **totalVotes**: `number` 24 | 25 | The total amount of votes recorded so far 26 | 27 | *** 28 | 29 | ### votes 30 | 31 | > **votes**: [`PollVote`](/reference/api/model/message/interfaces/PollVote.md)[] 32 | 33 | An arrray of vote objects 34 | -------------------------------------------------------------------------------- /docs/docs/reference/logging/logging/type-aliases/ConfigLogTransport.md: -------------------------------------------------------------------------------- 1 | # Type Alias: ConfigLogTransport 2 | 3 | > **ConfigLogTransport**: `object` 4 | 5 | ## Type declaration 6 | 7 | ### done? 8 | 9 | > `readonly` `optional` **done**: `boolean` 10 | 11 | If the transport has already been added to the logger. The logging set up command handles this for you. 12 | 13 | ### options? 14 | 15 | > `optional` **options**: `any` 16 | 17 | The options for the transport. Generally only required for syslog but you can use this to override default options for other types of transports. 18 | 19 | ### type 20 | 21 | > **type**: `"syslog"` \| `"console"` \| `"file"` \| `"ev"` 22 | 23 | The type of winston transport. At the moment only `file`, `console`, `ev` and `syslog` are supported. 24 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/reactions/type-aliases/ReactionEvent.md: -------------------------------------------------------------------------------- 1 | # Type Alias: ReactionEvent 2 | 3 | > **ReactionEvent**: `object` 4 | 5 | Emitted by onReaction 6 | 7 | ## Type declaration 8 | 9 | ### message 10 | 11 | > **message**: [`Message`](/reference/api/model/message/interfaces/Message.md) 12 | 13 | The message being reacted to 14 | 15 | ### reactionByMe 16 | 17 | > **reactionByMe**: [`Reaction`](/reference/api/model/reactions/type-aliases/Reaction.md) 18 | 19 | The reaction sent by the host account 20 | 21 | ### reactions 22 | 23 | > **reactions**: [`Reaction`](/reference/api/model/reactions/type-aliases/Reaction.md)[] 24 | 25 | An array of all reactions 26 | 27 | ### type 28 | 29 | > **type**: `"add"` \| `"change"` 30 | 31 | The type of the reaction event. 32 | -------------------------------------------------------------------------------- /docs/docs/how-to/use-a-proxy.md: -------------------------------------------------------------------------------- 1 | # Proxying your session 2 | 3 | It is extremely simple to use a proxy with @open-wa. Once you have your proxy protocol, address, port, username and password you just need to set the [[proxyServerCredentials]] and @open-wa will connect your session via the proxy. For example, if your proxy details are: 4 | 5 | ```text 6 | //this is dummy data 7 | 8 | protocol: http 9 | address: proxyaddress.abc 10 | port: 1234 11 | username: open-wa 12 | password: antidote 13 | ``` 14 | 15 | then your config will look something like this: 16 | 17 | ```javascript 18 | create({ 19 | proxyServerCredentials: { 20 | address: 'http://proxyaddress.abc:1234', 21 | username: 'open-wa', 22 | password: 'antidote' 23 | } 24 | }).then(client => start(client)); 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/plugins/tailwind-config.ts: -------------------------------------------------------------------------------- 1 | export function tailwindPlugin(context, options) { 2 | return { 3 | name: 'tailwind-plugin', 4 | injectHtmlTags() { 5 | return { 6 | headTags: [ 7 | { 8 | tagName: "link", 9 | attributes: { 10 | rel: "stylesheet", 11 | href: "https://cdn.jsdelivr.net/npm/tailwindcss/dist/preflight.min.css", 12 | }, 13 | }, 14 | ], 15 | }; 16 | }, 17 | configurePostCss(postcssOptions) { 18 | postcssOptions.plugins = [ 19 | // require('postcss-import'), 20 | require('tailwindcss'), 21 | require('autoprefixer'), 22 | ]; 23 | return postcssOptions; 24 | }, 25 | }; 26 | } -------------------------------------------------------------------------------- /docs/docs/reference/logging/logging/variables/log.md: -------------------------------------------------------------------------------- 1 | # Variable: log 2 | 3 | > `const` **log**: `Logger` 4 | 5 | You can access the log in your code and add your own custom transports 6 | https://github.com/winstonjs/winston#transports 7 | see [Logger](https://github.com/winstonjs/winston#transports) for more details. 8 | 9 | Here is an example of adding the GCP stackdriver transport: 10 | 11 | ``` 12 | import { log } from '@open-wa/wa-automate' 13 | import { LoggingWinston } from '@google-cloud/logging-winston'; 14 | 15 | const gcpTransport = new LoggingWinston({ 16 | projectId: 'your-project-id', 17 | keyFilename: '/path/to/keyfile.json' 18 | }); 19 | 20 | ... 21 | log.add( 22 | gcpTransport 23 | ) 24 | 25 | //Congrats! Now all of your session logs will also go to GCP Stackdriver 26 | ``` 27 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/group-metadata/enumerations/GroupNotificationTypes.md: -------------------------------------------------------------------------------- 1 | # Enumeration: GroupNotificationTypes 2 | 3 | Group notification types 4 | 5 | ## Enumeration Members 6 | 7 | ### ADD 8 | 9 | > **ADD**: `"add"` 10 | 11 | *** 12 | 13 | ### ANNOUNCE 14 | 15 | > **ANNOUNCE**: `"announce"` 16 | 17 | *** 18 | 19 | ### DESCRIPTION 20 | 21 | > **DESCRIPTION**: `"description"` 22 | 23 | *** 24 | 25 | ### INVITE 26 | 27 | > **INVITE**: `"invite"` 28 | 29 | *** 30 | 31 | ### LEAVE 32 | 33 | > **LEAVE**: `"leave"` 34 | 35 | *** 36 | 37 | ### PICTURE 38 | 39 | > **PICTURE**: `"picture"` 40 | 41 | *** 42 | 43 | ### REMOVE 44 | 45 | > **REMOVE**: `"remove"` 46 | 47 | *** 48 | 49 | ### RESTRICT 50 | 51 | > **RESTRICT**: `"restrict"` 52 | 53 | *** 54 | 55 | ### SUBJECT 56 | 57 | > **SUBJECT**: `"subject"` 58 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/enumerations/QRQuality.md: -------------------------------------------------------------------------------- 1 | # Enumeration: QRQuality 2 | 3 | The set values of quality you can set for the quality of the qr code output. Ten being the highest quality. 4 | 5 | ## Enumeration Members 6 | 7 | ### EIGHT 8 | 9 | > **EIGHT**: `0.8` 10 | 11 | *** 12 | 13 | ### FIVE 14 | 15 | > **FIVE**: `0.5` 16 | 17 | *** 18 | 19 | ### FOUR 20 | 21 | > **FOUR**: `0.4` 22 | 23 | *** 24 | 25 | ### NINE 26 | 27 | > **NINE**: `0.9` 28 | 29 | *** 30 | 31 | ### ONE 32 | 33 | > **ONE**: `0.1` 34 | 35 | *** 36 | 37 | ### SEVEN 38 | 39 | > **SEVEN**: `0.7` 40 | 41 | *** 42 | 43 | ### SIX 44 | 45 | > **SIX**: `0.6` 46 | 47 | *** 48 | 49 | ### TEN 50 | 51 | > **TEN**: `1` 52 | 53 | *** 54 | 55 | ### THREE 56 | 57 | > **THREE**: `0.3` 58 | 59 | *** 60 | 61 | ### TWO 62 | 63 | > **TWO**: `0.2` 64 | -------------------------------------------------------------------------------- /docs/src/theme/DocRoot/Layout/Sidebar/styles.module.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --doc-sidebar-width: 300px; 3 | --doc-sidebar-hidden-width: 30px; 4 | } 5 | 6 | .docSidebarContainer { 7 | display: none; 8 | } 9 | 10 | @media (min-width: 997px) { 11 | .docSidebarContainer { 12 | display: block; 13 | width: var(--doc-sidebar-width); 14 | margin-top: calc(-1 * var(--ifm-navbar-height)); 15 | border-right: 1px solid var(--ifm-toc-border-color); 16 | will-change: width; 17 | transition: width var(--ifm-transition-fast) ease; 18 | clip-path: inset(0); 19 | } 20 | 21 | .docSidebarContainerHidden { 22 | width: var(--doc-sidebar-hidden-width); 23 | cursor: pointer; 24 | } 25 | 26 | .sidebarViewport { 27 | top: 0; 28 | position: sticky; 29 | height: 100%; 30 | max-height: 100vh; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/group-metadata/index.md: -------------------------------------------------------------------------------- 1 | # api/model/group-metadata 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [GroupNotificationTypes](/reference/api/model/group-metadata/enumerations/GroupNotificationTypes.md) 8 | - [groupChangeEvent](/reference/api/model/group-metadata/enumerations/groupChangeEvent.md) 9 | 10 | ### Interfaces 11 | 12 | - [GenericGroupChangeEvent](/reference/api/model/group-metadata/interfaces/GenericGroupChangeEvent.md) 13 | - [GroupMetadata](/reference/api/model/group-metadata/interfaces/GroupMetadata.md) 14 | - [NewCommunityGroup](/reference/api/model/group-metadata/interfaces/NewCommunityGroup.md) 15 | - [Participant](/reference/api/model/group-metadata/interfaces/Participant.md) 16 | - [ParticipantChangedEventModel](/reference/api/model/group-metadata/interfaces/ParticipantChangedEventModel.md) 17 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/enumerations/LicenseType.md: -------------------------------------------------------------------------------- 1 | # Enumeration: LicenseType 2 | 3 | ## Enumeration Members 4 | 5 | ### B2B\_RESTRICTED\_VOLUME\_LICENSE 6 | 7 | > **B2B\_RESTRICTED\_VOLUME\_LICENSE**: `"B2B_RESTRICTED_VOLUME_LICENSE"` 8 | 9 | *** 10 | 11 | ### CUSTOM 12 | 13 | > **CUSTOM**: `"CUSTOM"` 14 | 15 | *** 16 | 17 | ### IMAGE\_STORY 18 | 19 | > **IMAGE\_STORY**: `"Image Story License Key"` 20 | 21 | *** 22 | 23 | ### INSIDER 24 | 25 | > **INSIDER**: `"Insiders Program"` 26 | 27 | *** 28 | 29 | ### NONE 30 | 31 | > **NONE**: `"NONE"` 32 | 33 | *** 34 | 35 | ### PREMIUM 36 | 37 | > **PREMIUM**: `"Premium License Key"` 38 | 39 | *** 40 | 41 | ### TEXT\_STORY 42 | 43 | > **TEXT\_STORY**: `"Text Story License Key"` 44 | 45 | *** 46 | 47 | ### VIDEO\_STORY 48 | 49 | > **VIDEO\_STORY**: `"Video Story License Key"` 50 | -------------------------------------------------------------------------------- /demo/message_queue.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * In this example, a simple and safe message queue is to send messages wihtout overwhelming the session. 3 | * 4 | * Here, a quite sensible queue is used. Every second, 2 messages get sent. You can adjust this for your requirements. 5 | * 6 | * https://www.npmjs.com/package/p-queue 7 | */ 8 | 9 | // import { create, Client, SimpleListener } from '@open-wa/wa-automate'; 10 | import { create, Client } from '../src/index'; 11 | 12 | const { default: PQueue } = require("p-queue"); 13 | const queue = new PQueue({ concurrency: 2, timeout: 1000 }); 14 | 15 | create() 16 | .then(async (client:Client) => { 17 | const {me} = await client.getMe() 18 | 19 | for (let i = 0; i < 25; i++) { 20 | await queue.add(()=>client.sendText(me._serialized,''+i)) 21 | } 22 | }) 23 | .catch(e=>console.log('Error',e.message)); -------------------------------------------------------------------------------- /docs/docs/reference/api/model/errors/enumerations/AddParticipantErrorStatusCode.md: -------------------------------------------------------------------------------- 1 | # Enumeration: AddParticipantErrorStatusCode 2 | 3 | Add Participants Status Code Enum 4 | 5 | ## Enumeration Members 6 | 7 | ### ALREADY\_IN\_GROUP 8 | 9 | > **ALREADY\_IN\_GROUP**: `409` 10 | 11 | Participant could not be added to group because they are already in the group 12 | 13 | *** 14 | 15 | ### GROUP\_FULL 16 | 17 | > **GROUP\_FULL**: `500` 18 | 19 | Participant could not be added to group because the group is full 20 | 21 | *** 22 | 23 | ### PRIVACY\_SETTINGS 24 | 25 | > **PRIVACY\_SETTINGS**: `403` 26 | 27 | Participant could not be added to group because their privacy settings do not allow you to add them. 28 | 29 | *** 30 | 31 | ### RECENTLY\_LEFT 32 | 33 | > **RECENTLY\_LEFT**: `408` 34 | 35 | Participant could not be added to group because they recently left. 36 | -------------------------------------------------------------------------------- /src/api/model/label.ts: -------------------------------------------------------------------------------- 1 | import { ContactId, ChatId, MessageId } from "./aliases"; 2 | 3 | export interface Label { 4 | /** 5 | * The internal ID of the label. Usually a number represented as a string e.g "1" 6 | */ 7 | id: string, 8 | /** 9 | * The text contents of the label 10 | */ 11 | name: string, 12 | /** 13 | * The items that are tagged with this label 14 | */ 15 | items: { 16 | /** 17 | * Labels can be applied to chats, contacts or individual messages. This represents the type of object the label is attached to. 18 | */ 19 | type: "Chat" | "Contact" | "Message", 20 | /** 21 | * The ID of the object that the label is atteched to. 22 | */ 23 | id: ContactId | ChatId | MessageId 24 | }[] 25 | } -------------------------------------------------------------------------------- /src/logging/custom_transport.ts: -------------------------------------------------------------------------------- 1 | import TransportStream from 'winston-transport'; 2 | import { ev } from '../controllers/events'; 3 | 4 | export class LogToEvTransport extends TransportStream { 5 | constructor(opts?: any) { 6 | super(opts); 7 | } 8 | 9 | log(info, callback) { 10 | setImmediate(() => { 11 | this.emit('logged', info); 12 | }); 13 | ev.emit( 14 | `DEBUG.${info.level}`, 15 | Object.keys(info).reduce((p, c) => (p = { ...p, [c]: info[c] }), {}) 16 | ); 17 | if (callback) return callback(null, true); 18 | } 19 | } 20 | 21 | export class NoOpTransport extends TransportStream { 22 | constructor(opts?: any) { 23 | super(opts); 24 | } 25 | 26 | log(info, callback) { 27 | setImmediate(() => { 28 | this.emit('logged', info); 29 | }); 30 | if (callback) return callback(null, true); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /docs/blog/2021-08-26-welcome/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: welcome 3 | title: Welcome 4 | authors: [slorber, yangshun] 5 | tags: [facebook, hello, docusaurus] 6 | --- 7 | 8 | [Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog). 9 | 10 | Simply add Markdown files (or folders) to the `blog` directory. 11 | 12 | Regular blog authors can be added to `authors.yml`. 13 | 14 | The blog post date can be extracted from filenames, such as: 15 | 16 | - `2019-05-30-welcome.md` 17 | - `2019-05-30-welcome/index.md` 18 | 19 | A blog post folder can be convenient to co-locate blog post images: 20 | 21 | ![Docusaurus Plushie](./docusaurus-plushie-banner.jpeg) 22 | 23 | The blog supports tags as well! 24 | 25 | **And if you don't want a blog**: just delete this directory, and use `blog: false` in your Docusaurus config. 26 | -------------------------------------------------------------------------------- /docs/sidebars.ts: -------------------------------------------------------------------------------- 1 | import type {SidebarsConfig} from '@docusaurus/plugin-content-docs'; 2 | 3 | /** 4 | * Creating a sidebar enables you to: 5 | - create an ordered group of docs 6 | - render a sidebar for each doc of that group 7 | - provide next/previous navigation 8 | 9 | The sidebars can be generated from the filesystem, or explicitly defined here. 10 | 11 | Create as many sidebars as you want. 12 | */ 13 | const sidebars: SidebarsConfig = { 14 | // By default, Docusaurus generates a sidebar from the docs folder structure 15 | tutorialSidebar: [{type: 'autogenerated', dirName: '.'}], 16 | 17 | // But you can create a sidebar manually 18 | /* 19 | tutorialSidebar: [ 20 | 'intro', 21 | 'hello', 22 | { 23 | type: 'category', 24 | label: 'Tutorial', 25 | items: ['tutorial-basics/create-a-document'], 26 | }, 27 | ], 28 | */ 29 | }; 30 | 31 | export default sidebars; 32 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Collector/interfaces/CollectorOptions.md: -------------------------------------------------------------------------------- 1 | # Interface: CollectorOptions 2 | 3 | Options to be applied to the collector. 4 | 5 | ## Extended by 6 | 7 | - [`AwaitMessagesOptions`](/reference/structures/Collector/interfaces/AwaitMessagesOptions.md) 8 | 9 | ## Properties 10 | 11 | ### dispose? 12 | 13 | > `optional` **dispose**: `boolean` 14 | 15 | Whether to dispose data when it's deleted 16 | 17 | *** 18 | 19 | ### idle? 20 | 21 | > `optional` **idle**: `number` 22 | 23 | Max time allowed idle 24 | 25 | *** 26 | 27 | ### max? 28 | 29 | > `optional` **max**: `number` 30 | 31 | The maximum amount of items to collect 32 | 33 | *** 34 | 35 | ### maxProcessed? 36 | 37 | > `optional` **maxProcessed**: `number` 38 | 39 | The maximum amount of items to process 40 | 41 | *** 42 | 43 | ### time? 44 | 45 | > `optional` **time**: `number` 46 | 47 | Max time to wait for items in milliseconds 48 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Dialog/interfaces/DialogProperty.md: -------------------------------------------------------------------------------- 1 | # Interface: DialogProperty 2 | 3 | ## Properties 4 | 5 | ### key 6 | 7 | > **key**: `string` 8 | 9 | *** 10 | 11 | ### options? 12 | 13 | > `optional` **options**: [`DialogButtons`](/reference/structures/Dialog/interfaces/DialogButtons.md)[] \| [`DialogListMessageSection`](/reference/structures/Dialog/interfaces/DialogListMessageSection.md)[] 14 | 15 | *** 16 | 17 | ### order 18 | 19 | > **order**: `number` 20 | 21 | *** 22 | 23 | ### prompt 24 | 25 | > **prompt**: `string` 26 | 27 | *** 28 | 29 | ### skipCondition? 30 | 31 | > `optional` **skipCondition**: [`CheckFunction`](/reference/structures/Dialog/type-aliases/CheckFunction.md) 32 | 33 | *** 34 | 35 | ### type 36 | 37 | > **type**: `string` 38 | 39 | *** 40 | 41 | ### validation 42 | 43 | > **validation**: [`DialogValidation`](/reference/structures/Dialog/interfaces/DialogValidation.md)[] 44 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/enumerations/OnError.md: -------------------------------------------------------------------------------- 1 | # Enumeration: OnError 2 | 3 | ## Enumeration Members 4 | 5 | ### AS\_STRING 6 | 7 | > **AS\_STRING**: `"AS_STRING"` 8 | 9 | Return it as a string 10 | 11 | *** 12 | 13 | ### LOG\_AND\_FALSE 14 | 15 | > **LOG\_AND\_FALSE**: `"LOG_AND_FALSE"` 16 | 17 | Log the error and return false 18 | 19 | *** 20 | 21 | ### LOG\_AND\_STRING 22 | 23 | > **LOG\_AND\_STRING**: `"LOG_AND_STRING"` 24 | 25 | Log the error AND return the string 26 | 27 | *** 28 | 29 | ### NOTHING 30 | 31 | > **NOTHING**: `"NOTHING"` 32 | 33 | Do nothing. 34 | 35 | *** 36 | 37 | ### RETURN\_ERROR 38 | 39 | > **RETURN\_ERROR**: `"RETURN_ERROR"` 40 | 41 | Return the error object 42 | 43 | *** 44 | 45 | ### RETURN\_FALSE 46 | 47 | > **RETURN\_FALSE**: `"RETURN_FALSE"` 48 | 49 | Do not log anything, just return `false` 50 | 51 | *** 52 | 53 | ### THROW 54 | 55 | > **THROW**: `"THROW"` 56 | 57 | throw the error 58 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Website 2 | 3 | This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. 4 | 5 | ### Installation 6 | 7 | ``` 8 | $ yarn 9 | ``` 10 | 11 | ### Local Development 12 | 13 | ``` 14 | $ yarn start 15 | ``` 16 | 17 | This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. 18 | 19 | ### Build 20 | 21 | ``` 22 | $ yarn build 23 | ``` 24 | 25 | This command generates static content into the `build` directory and can be served using any static contents hosting service. 26 | 27 | ### Deployment 28 | 29 | Using SSH: 30 | 31 | ``` 32 | $ USE_SSH=true yarn deploy 33 | ``` 34 | 35 | Not using SSH: 36 | 37 | ``` 38 | $ GIT_USER= yarn deploy 39 | ``` 40 | 41 | If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. 42 | -------------------------------------------------------------------------------- /.github/workflows/comment-run.yml: -------------------------------------------------------------------------------- 1 | name: "Comment run" 2 | on: 3 | issue_comment: 4 | types: [created, edited] 5 | 6 | jobs: 7 | comment-run: 8 | runs-on: ubuntu-20.04 9 | steps: 10 | - name: Install emojis 11 | run: sudo apt install fonts-noto-color-emoji 12 | - name: Update NPM 13 | run: sudo npm install -g npm@10.1.0 14 | - name: Set npm token 15 | run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc 16 | - uses: actions/checkout@v2 17 | with: 18 | # 0 indicates all history 19 | fetch-depth: 0 20 | - uses: nwtgck/actions-comment-run@v1.1.3 21 | with: 22 | github-token: ${{ secrets.CUSTOM_GH_TOKEN }} 23 | allowed-associations: '["OWNER", "MEMBER"]' 24 | env: 25 | NPM_TOKEN: ${{secrets.NPM_TOKEN}} 26 | GITHUB_TOKEN: ${{ secrets.CUSTOM_GH_TOKEN }} 27 | GIT_USER: smashah 28 | GIT_PASS: ${{ secrets.CUSTOM_GH_TOKEN }} 29 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | tsconfig.json 2 | src 3 | session 4 | assets 5 | demo 6 | docs 7 | resources 8 | .deepsource.toml 9 | .prettierignore 10 | .prettierrc 11 | .release-it.json 12 | CHANGELOG.md 13 | compact-keepchangelog.hbs 14 | prebuild.ts 15 | release-image.js 16 | sandbox.ts 17 | tempchangelog.txt 18 | .github 19 | session 20 | newsession 21 | **req.ts 22 | **qr_code_session.png 23 | **.re.js 24 | release.png 25 | **.data.json 26 | patches.json 27 | _cn 28 | docfix.ts 29 | test 30 | docs-source 31 | cname-fix.ts 32 | compact-keepachangelog.hbs 33 | CHANGELOG.md 34 | **.ignore.** 35 | CHANGELOG_NEW.md 36 | patches 37 | fragments 38 | types-only 39 | bin/*config.json 40 | bin/*col.json 41 | bin/*collection.json 42 | bin/*_* 43 | logs 44 | docs* 45 | .eslintrc.json 46 | *.node-persist* 47 | .vscode/* 48 | **/bin/cli.config** 49 | **/bin/localhost** 50 | **/bin/**zst 51 | **/bin/cli.config.js 52 | **/bin/localhost.crt 53 | **/bin/localhost.key 54 | **/bin/session.data.zst -------------------------------------------------------------------------------- /docs/src/theme/DocRoot/Layout/Main/index.tsx: -------------------------------------------------------------------------------- 1 | import React, {type ReactNode} from 'react'; 2 | import clsx from 'clsx'; 3 | import {useDocsSidebar} from '@docusaurus/plugin-content-docs/client'; 4 | import type {Props} from '@theme/DocRoot/Layout/Main'; 5 | 6 | import styles from './styles.module.css'; 7 | 8 | export default function DocRootLayoutMain({ 9 | hiddenSidebarContainer, 10 | children, 11 | }: Props): ReactNode { 12 | const sidebar = useDocsSidebar(); 13 | return ( 14 |
19 |
25 | {children} 26 |
27 |
28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/interfaces/MessageInfo.md: -------------------------------------------------------------------------------- 1 | # Interface: MessageInfo 2 | 3 | ## Properties 4 | 5 | ### delivery 6 | 7 | > **delivery**: [`MessageInfoInteraction`](/reference/api/model/message/interfaces/MessageInfoInteraction.md)[] 8 | 9 | *** 10 | 11 | ### deliveryRemaining 12 | 13 | > **deliveryRemaining**: `number` 14 | 15 | *** 16 | 17 | ### id 18 | 19 | > **id**: [`MessageId`](/reference/api/model/aliases/type-aliases/MessageId.md) 20 | 21 | The ID of the message 22 | 23 | *** 24 | 25 | ### played 26 | 27 | > **played**: [`MessageInfoInteraction`](/reference/api/model/message/interfaces/MessageInfoInteraction.md)[] 28 | 29 | *** 30 | 31 | ### playedRemaining 32 | 33 | > **playedRemaining**: `number` 34 | 35 | *** 36 | 37 | ### read 38 | 39 | > **read**: [`MessageInfoInteraction`](/reference/api/model/message/interfaces/MessageInfoInteraction.md)[] 40 | 41 | *** 42 | 43 | ### readRemaining 44 | 45 | > **readRemaining**: `number` 46 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/index.md: -------------------------------------------------------------------------------- 1 | # api/model/message 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [MessageAck](/reference/api/model/message/enumerations/MessageAck.md) 8 | - [MessageTypes](/reference/api/model/message/enumerations/MessageTypes.md) 9 | 10 | ### Interfaces 11 | 12 | - [Message](/reference/api/model/message/interfaces/Message.md) 13 | - [MessageInfo](/reference/api/model/message/interfaces/MessageInfo.md) 14 | - [MessageInfoInteraction](/reference/api/model/message/interfaces/MessageInfoInteraction.md) 15 | - [PollData](/reference/api/model/message/interfaces/PollData.md) 16 | - [PollOption](/reference/api/model/message/interfaces/PollOption.md) 17 | - [PollVote](/reference/api/model/message/interfaces/PollVote.md) 18 | - [QuoteMap](/reference/api/model/message/interfaces/QuoteMap.md) 19 | - [ReactionSender](/reference/api/model/message/interfaces/ReactionSender.md) 20 | 21 | ### Type Aliases 22 | 23 | - [MessagePinDuration](/reference/api/model/message/type-aliases/MessagePinDuration.md) 24 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/Dialog/index.md: -------------------------------------------------------------------------------- 1 | # structures/Dialog 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [ValidationType](/reference/structures/Dialog/enumerations/ValidationType.md) 8 | 9 | ### Interfaces 10 | 11 | - [CurrentDialogProps](/reference/structures/Dialog/interfaces/CurrentDialogProps.md) 12 | - [DialogButtons](/reference/structures/Dialog/interfaces/DialogButtons.md) 13 | - [DialogListMessageRow](/reference/structures/Dialog/interfaces/DialogListMessageRow.md) 14 | - [DialogListMessageSection](/reference/structures/Dialog/interfaces/DialogListMessageSection.md) 15 | - [DialogProperty](/reference/structures/Dialog/interfaces/DialogProperty.md) 16 | - [DialogState](/reference/structures/Dialog/interfaces/DialogState.md) 17 | - [DialogTemplate](/reference/structures/Dialog/interfaces/DialogTemplate.md) 18 | - [DialogValidation](/reference/structures/Dialog/interfaces/DialogValidation.md) 19 | 20 | ### Type Aliases 21 | 22 | - [CheckFunction](/reference/structures/Dialog/type-aliases/CheckFunction.md) 23 | -------------------------------------------------------------------------------- /types-only/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2015" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, 4 | "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, 5 | "declaration": true /* Generates corresponding '.d.ts' file. */, 6 | "emitDeclarationOnly": true, 7 | "outDir": "./dist" /* Redirect output structure to the directory. */, 8 | "removeComments": false /* Do not emit comments to output. */, 9 | "skipLibCheck": true, 10 | "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */, 11 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 12 | }, 13 | "include": [ 14 | "../src/**/*" 15 | ] 16 | } -------------------------------------------------------------------------------- /docs/docs/reference/api/model/chat/index.md: -------------------------------------------------------------------------------- 1 | # api/model/chat 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [ChatMuteDuration](/reference/api/model/chat/enumerations/ChatMuteDuration.md) 8 | - [ChatState](/reference/api/model/chat/enumerations/ChatState.md) 9 | - [ChatTypes](/reference/api/model/chat/enumerations/ChatTypes.md) 10 | 11 | ### Interfaces 12 | 13 | - [BaseChat](/reference/api/model/chat/interfaces/BaseChat.md) 14 | - [GroupChat](/reference/api/model/chat/interfaces/GroupChat.md) 15 | - [GroupChatCreationParticipantAddResponse](/reference/api/model/chat/interfaces/GroupChatCreationParticipantAddResponse.md) 16 | - [GroupChatCreationResponse](/reference/api/model/chat/interfaces/GroupChatCreationResponse.md) 17 | - [LiveLocationChangedEvent](/reference/api/model/chat/interfaces/LiveLocationChangedEvent.md) 18 | - [SingleChat](/reference/api/model/chat/interfaces/SingleChat.md) 19 | 20 | ### Type Aliases 21 | 22 | - [Chat](/reference/api/model/chat/type-aliases/Chat.md) 23 | - [EphemeralDuration](/reference/api/model/chat/type-aliases/EphemeralDuration.md) 24 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/reactions/type-aliases/ReactionRecord.md: -------------------------------------------------------------------------------- 1 | # Type Alias: ReactionRecord 2 | 3 | > **ReactionRecord**: `object` 4 | 5 | The specific reaction by a user 6 | 7 | ## Type declaration 8 | 9 | ### ack 10 | 11 | > **ack**: [`MessageAck`](/reference/api/model/message/enumerations/MessageAck.md) 12 | 13 | The acknowledgement of the reaction 14 | 15 | ### id 16 | 17 | > **id**: `string` 18 | 19 | The ID of the reaction 20 | 21 | ### msgKey 22 | 23 | > **msgKey**: `string` 24 | 25 | ### orphan 26 | 27 | > **orphan**: `number` 28 | 29 | ### parentMsgKey 30 | 31 | > **parentMsgKey**: `string` 32 | 33 | ### reactionText 34 | 35 | > **reactionText**: `string` 36 | 37 | The text of the reaction 38 | 39 | ### read 40 | 41 | > **read**: `boolean` 42 | 43 | If the reaction has been read 44 | 45 | ### senderUserJid 46 | 47 | > **senderUserJid**: [`ContactId`](/reference/api/model/aliases/type-aliases/ContactId.md) 48 | 49 | The ID of the reaction sender 50 | 51 | ### timestamp 52 | 53 | > **timestamp**: `number` 54 | 55 | The timestamp of the reaction 56 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/product/interfaces/Order.md: -------------------------------------------------------------------------------- 1 | # Interface: Order 2 | 3 | ## Properties 4 | 5 | ### createdAt 6 | 7 | > **createdAt**: `number` 8 | 9 | epoch ts divided by 1000 10 | 11 | *** 12 | 13 | ### currency 14 | 15 | > **currency**: `string` 16 | 17 | The [**ISO 4217**](https://en.wikipedia.org/wiki/ISO_4217) 3 letter currency code. E.g (Swedish krona) 18 | `SEK` 19 | 20 | *** 21 | 22 | ### id 23 | 24 | > **id**: `string` 25 | 26 | Order ID 27 | 28 | *** 29 | 30 | ### message? 31 | 32 | > `optional` **message**: [`Message`](/reference/api/model/message/interfaces/Message.md) 33 | 34 | The message object associated with the order. Only populated in `onOrder` callback. 35 | 36 | *** 37 | 38 | ### products 39 | 40 | > **products**: [`CartItem`](/reference/api/model/product/interfaces/CartItem.md)[] 41 | 42 | An array of items in the cart 43 | 44 | *** 45 | 46 | ### sellerJid 47 | 48 | > **sellerJid**: `string` 49 | 50 | *** 51 | 52 | ### subtotal 53 | 54 | > **subtotal**: \`$\{number\}\` 55 | 56 | *** 57 | 58 | ### total 59 | 60 | > **total**: \`$\{number\}\` 61 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/chat/interfaces/GroupChatCreationParticipantAddResponse.md: -------------------------------------------------------------------------------- 1 | # Interface: GroupChatCreationParticipantAddResponse 2 | 3 | ## Properties 4 | 5 | ### code 6 | 7 | > **code**: `200` \| `400` \| `403` 8 | 9 | The resultant status code for adding the participant. 10 | 11 | 200 if the participant was added successfully during the creation of the group. 12 | 13 | 403 if the participant does not allow their account to be added to group chats. If you receive a 403, you will also get an `invite_code` and `invite_code_exp` 14 | 15 | *** 16 | 17 | ### invite\_code? 18 | 19 | > `optional` **invite\_code**: `string` 20 | 21 | If the participant is not allowed to be added to group chats due to their privacy settings, you will receive an `invite_code` which you can send to them via a text. 22 | 23 | *** 24 | 25 | ### invite\_code\_exp? 26 | 27 | > `optional` **invite\_code\_exp**: `string` 28 | 29 | The expiry ts of the invite_code. It is a number wrapped in a string, in order to get the proper time you can use this: 30 | 31 | ```javascript 32 | new Date(Number(invite_code_exp)*1000) 33 | ``` 34 | -------------------------------------------------------------------------------- /demo/server.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This example shows how to use client.registerWebhook to easily set up webhooks. You can see the valid webhooks here: 3 | * https://open-wa.github.io/wa-automate-nodejs/enums/SimpleListener.html 4 | */ 5 | 6 | //Please see these docs: https://open-wa.github.io/wa-automate-nodejs/classes/client.html#middleware 7 | 8 | // import { create, Client, SimpleListener } from '@open-wa/wa-automate'; 9 | import { create, Client, SimpleListener } from '../src/index'; 10 | 11 | const express = require('express'); 12 | const app = express(); 13 | app.use(express.json({limit: '200mb'})) //add the limit option so we can send base64 data through the api 14 | const PORT = 8082; 15 | 16 | //Create your webhook here: https://webhook.site/ 17 | const WEBHOOK_ADDRESS = 'PASTE_WEBHOOK_DOT_SITE_UNIQUE_URL_HERE' 18 | 19 | create({ sessionId:'session1'}) 20 | .then(async (client:Client) => { 21 | app.use(client.middleware()); 22 | Object.keys(SimpleListener).map(eventKey=>client.registerWebhook(SimpleListener[eventKey],WEBHOOK_ADDRESS)) 23 | app.listen(PORT, ()=>console.log(`\n• Listening on port ${PORT}!`)); 24 | }) 25 | .catch(e=>console.log('Error',e.message)); -------------------------------------------------------------------------------- /docs/docs/reference/api/model/call/enumerations/CallState.md: -------------------------------------------------------------------------------- 1 | # Enumeration: CallState 2 | 3 | ## Enumeration Members 4 | 5 | ### ACTIVE 6 | 7 | > **ACTIVE**: `"ACTIVE"` 8 | 9 | *** 10 | 11 | ### CONNECTING 12 | 13 | > **CONNECTING**: `"CONNECTING"` 14 | 15 | *** 16 | 17 | ### CONNECTION\_LOST 18 | 19 | > **CONNECTION\_LOST**: `"CONNECTION_LOST"` 20 | 21 | *** 22 | 23 | ### ENDED 24 | 25 | > **ENDED**: `"ENDED"` 26 | 27 | *** 28 | 29 | ### FAILED 30 | 31 | > **FAILED**: `"FAILED"` 32 | 33 | *** 34 | 35 | ### HANDLED\_REMOTELY 36 | 37 | > **HANDLED\_REMOTELY**: `"HANDLED_REMOTELY"` 38 | 39 | *** 40 | 41 | ### INCOMING\_RING 42 | 43 | > **INCOMING\_RING**: `"INCOMING_RING"` 44 | 45 | *** 46 | 47 | ### NOT\_ANSWERED 48 | 49 | > **NOT\_ANSWERED**: `"NOT_ANSWERED"` 50 | 51 | *** 52 | 53 | ### OUTGOING\_CALLING 54 | 55 | > **OUTGOING\_CALLING**: `"OUTGOING_CALLING"` 56 | 57 | *** 58 | 59 | ### OUTGOING\_RING 60 | 61 | > **OUTGOING\_RING**: `"OUTGOING_RING"` 62 | 63 | *** 64 | 65 | ### REJECTED 66 | 67 | > **REJECTED**: `"REJECTED"` 68 | 69 | *** 70 | 71 | ### REMOTE\_CALL\_IN\_PROGRESS 72 | 73 | > **REMOTE\_CALL\_IN\_PROGRESS**: `"REMOTE_CALL_IN_PROGRESS"` 74 | -------------------------------------------------------------------------------- /docs/docs/reference/controllers/events/variables/ev.md: -------------------------------------------------------------------------------- 1 | # Variable: ev 2 | 3 | > `const` **ev**: `EventEmitter2` 4 | 5 | This is the library's event emitter. Use this to listen to internal events of the library like so: 6 | ```javascript 7 | ev.on('event', callback) 8 | ``` 9 | 10 | The event you want to listen to is in the format of [namespace].[sessionId] 11 | 12 | The event can include wildcards. 13 | 14 | For example, to listen to all qr code events, the event will be `qr.**`. e.g: 15 | 16 | ```javascript 17 | ev.on('qr.**',... 18 | ``` 19 | 20 | Listen to all sessionData events 21 | 22 | ```javascript 23 | ev.on('sessionData.**',... 24 | ``` 25 | 26 | Listen to all events from session1 27 | 28 | ```javascript 29 | ev.on('**.session1',... 30 | ``` 31 | 32 | Listen to all events 33 | 34 | ```javascript 35 | ev.on('**.**',... 36 | ``` 37 | 38 | ev always emits data, sessionId and the namespace which is helpful to know if there are multiple sessions or you're listening to events from all namespaces 39 | 40 | ```javascript 41 | ev.on('**.**', (data, sessionId, namespace) => { 42 | 43 | console.log(`${namespace} event detected for session ${sessionId}`, data) 44 | 45 | }); 46 | ``` 47 | -------------------------------------------------------------------------------- /docs/docs/reference/controllers/initializer/functions/create.md: -------------------------------------------------------------------------------- 1 | # Function: create() 2 | 3 | > **create**(`config`): `Promise`\<[`Client`](/reference/api/Client/classes/Client.md)\> 4 | 5 | Used to initialize the client session. 6 | 7 | *Note* It is required to set all config variables as [ConfigObject](https://open-wa.github.io/wa-automate-nodejs/interfaces/configobject.html) that includes both [sessionId](https://open-wa.github.io/wa-automate-nodejs/interfaces/configobject.html#sessionId). Setting the session id as the first variable is no longer valid 8 | 9 | e.g 10 | 11 | ```javascript 12 | create({ 13 | sessionId: 'main', 14 | customUserAgent: ' 'WhatsApp/2.16.352 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15', 15 | blockCrashLogs true, 16 | ... 17 | }).... 18 | ``` 19 | 20 | ## Parameters 21 | 22 | • **config**: [`ConfigObject`](/reference/api/model/config/interfaces/ConfigObject.md) \| [`AdvancedConfig`](/reference/api/model/config/type-aliases/AdvancedConfig.md) = `{}` 23 | 24 | AdvancedConfig The extended custom configuration 25 | 26 | ## Returns 27 | 28 | `Promise`\<[`Client`](/reference/api/Client/classes/Client.md)\> 29 | -------------------------------------------------------------------------------- /docs/src/theme/DocRoot/Layout/Sidebar/ExpandButton/index.tsx: -------------------------------------------------------------------------------- 1 | import React, {type ReactNode} from 'react'; 2 | import {translate} from '@docusaurus/Translate'; 3 | import IconArrow from '@theme/Icon/Arrow'; 4 | import type {Props} from '@theme/DocRoot/Layout/Sidebar/ExpandButton'; 5 | 6 | import styles from './styles.module.css'; 7 | 8 | export default function DocRootLayoutSidebarExpandButton({ 9 | toggleSidebar, 10 | }: Props): ReactNode { 11 | return ( 12 |
30 | 31 |
32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /docs/docs/reference/structures/preProcessors/type-aliases/MessagePreProcessor.md: -------------------------------------------------------------------------------- 1 | # Type Alias: MessagePreProcessor() 2 | 3 | > **MessagePreProcessor**: (`message`, `client`?, `alreadyProcessed`?, `source`?) => `Promise`\<[`Message`](/reference/api/model/message/interfaces/Message.md)\> 4 | 5 | A function that takes a message and returns a message. 6 | 7 | ## Parameters 8 | 9 | • **message**: [`Message`](/reference/api/model/message/interfaces/Message.md) 10 | 11 | The message to be processed 12 | 13 | • **client?**: [`Client`](/reference/api/Client/classes/Client.md) 14 | 15 | The client that received the message 16 | 17 | • **alreadyProcessed?**: `boolean` 18 | 19 | Whether the message has already been processed by another preprocessor. (This is useful in cases where you want to mutate the message for both onMessage and onAnyMessage events but only want to do the actual process, like uploading to s3, once.) 20 | 21 | • **source?**: `"onMessage"` \| `"onAnyMessage"` 22 | 23 | The source of the message. This is useful for knowing if the message is from onMessage or onAnyMessage. Only processing one source will prevent duplicate processing. 24 | 25 | ## Returns 26 | 27 | `Promise`\<[`Message`](/reference/api/model/message/interfaces/Message.md)\> 28 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/index.md: -------------------------------------------------------------------------------- 1 | # api/model/config 2 | 3 | ## Index 4 | 5 | ### Enumerations 6 | 7 | - [CLOUD\_PROVIDERS](/reference/api/model/config/enumerations/CLOUD_PROVIDERS.md) 8 | - [DIRECTORY\_STRATEGY](/reference/api/model/config/enumerations/DIRECTORY_STRATEGY.md) 9 | - [LicenseType](/reference/api/model/config/enumerations/LicenseType.md) 10 | - [NotificationLanguage](/reference/api/model/config/enumerations/NotificationLanguage.md) 11 | - [OnError](/reference/api/model/config/enumerations/OnError.md) 12 | - [QRFormat](/reference/api/model/config/enumerations/QRFormat.md) 13 | - [QRQuality](/reference/api/model/config/enumerations/QRQuality.md) 14 | 15 | ### Interfaces 16 | 17 | - [ConfigObject](/reference/api/model/config/interfaces/ConfigObject.md) 18 | - [DevTools](/reference/api/model/config/interfaces/DevTools.md) 19 | - [EventPayload](/reference/api/model/config/interfaces/EventPayload.md) 20 | - [ProxyServerCredentials](/reference/api/model/config/interfaces/ProxyServerCredentials.md) 21 | - [SessionData](/reference/api/model/config/interfaces/SessionData.md) 22 | - [Webhook](/reference/api/model/config/interfaces/Webhook.md) 23 | 24 | ### Type Aliases 25 | 26 | - [AdvancedConfig](/reference/api/model/config/type-aliases/AdvancedConfig.md) 27 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/enumerations/MessageTypes.md: -------------------------------------------------------------------------------- 1 | # Enumeration: MessageTypes 2 | 3 | Message types 4 | 5 | ## Enumeration Members 6 | 7 | ### AUDIO 8 | 9 | > **AUDIO**: `"audio"` 10 | 11 | *** 12 | 13 | ### BUTTONS\_RESPONSE 14 | 15 | > **BUTTONS\_RESPONSE**: `"buttons_response"` 16 | 17 | *** 18 | 19 | ### CONTACT\_CARD 20 | 21 | > **CONTACT\_CARD**: `"vcard"` 22 | 23 | *** 24 | 25 | ### CONTACT\_CARD\_MULTI 26 | 27 | > **CONTACT\_CARD\_MULTI**: `"multi_vcard"` 28 | 29 | *** 30 | 31 | ### DOCUMENT 32 | 33 | > **DOCUMENT**: `"document"` 34 | 35 | *** 36 | 37 | ### IMAGE 38 | 39 | > **IMAGE**: `"image"` 40 | 41 | *** 42 | 43 | ### LIST\_RESPONSE 44 | 45 | > **LIST\_RESPONSE**: `"list_response"` 46 | 47 | *** 48 | 49 | ### LOCATION 50 | 51 | > **LOCATION**: `"location"` 52 | 53 | *** 54 | 55 | ### ORDER 56 | 57 | > **ORDER**: `"order"` 58 | 59 | *** 60 | 61 | ### REVOKED 62 | 63 | > **REVOKED**: `"revoked"` 64 | 65 | *** 66 | 67 | ### STICKER 68 | 69 | > **STICKER**: `"sticker"` 70 | 71 | *** 72 | 73 | ### TEXT 74 | 75 | > **TEXT**: `"chat"` 76 | 77 | *** 78 | 79 | ### UNKNOWN 80 | 81 | > **UNKNOWN**: `"unknown"` 82 | 83 | *** 84 | 85 | ### VIDEO 86 | 87 | > **VIDEO**: `"video"` 88 | 89 | *** 90 | 91 | ### VOICE 92 | 93 | > **VOICE**: `"ptt"` 94 | -------------------------------------------------------------------------------- /docs/src/config/typedoc.ts: -------------------------------------------------------------------------------- 1 | export const typedocOptions = { 2 | "entryPoints": [ 3 | "../src/api", 4 | "../src/utils", 5 | "../src/controllers", 6 | "../src/structures", 7 | "../src/connect", 8 | "../src/logging", 9 | ], 10 | "exclude": [ 11 | "**.config", 12 | "**/**ignore**", 13 | "**/**browser.ts", 14 | "**/popup/**", 15 | "**/utils/**", 16 | "**/**auth**", 17 | "**/**launch_checks**", 18 | "**/**preload**", 19 | ], 20 | "hidePageHeader": true, 21 | "entryFileName": "index.md", 22 | hideBreadcrumbs: true, 23 | // hideInPageTOC: true, //TODO: REPLACE WITH `typedoc-plugin-remark` and the `remark-toc` plugin. 24 | // indexTitle: 'Exports', // The option `indexTitle` has been removed. Please use the `"title.indexPage"` key with option `--textContentMappings`. 25 | publicPath: '/reference/', 26 | "out": "./docs/reference", 27 | tsconfig: '../_tsconfig.docs.json', 28 | readme: "none", 29 | // allReflectionsHaveOwnDocument: true, 30 | // entryFileName: 'reference', //TODO: The option `entryDocument` has been renamed to `entryFileName` to better reflect its purpose. 31 | watch: process.env.TYPEDOC_WATCH, 32 | sidebar: { 33 | categoryLabel: 'API Reference', 34 | position: 0, 35 | fullNames: false 36 | }, 37 | } -------------------------------------------------------------------------------- /docs/docs/configuration/launch-events.md: -------------------------------------------------------------------------------- 1 | # Launch Events 2 | 3 | When you call [create] there is actually a lot happening in the background and in some use cases, it may be useful to listen to those events. In order to do this you have to use the built in event emitter [`ev`](/TODO): 4 | 5 | ```javascript 6 | import { ev } from '@open-wa/wa-automate'; 7 | 8 | ev.on('event', callback) 9 | ``` 10 | 11 | The event you want to listen to is in the format of [namespace].[sessionId] 12 | 13 | The event can include wildcards. 14 | 15 | For example, to listen to all qr code events, the event will be `qr.**`. e.g: 16 | 17 | ```javascript 18 | ev.on('qr.**',... 19 | ``` 20 | 21 | Listen to all sessionData events 22 | 23 | ```javascript 24 | ev.on('sessionData.**',... 25 | ``` 26 | 27 | Listen to all events from session1 28 | 29 | ```javascript 30 | ev.on('**.session1',... 31 | ``` 32 | 33 | Listen to all events 34 | 35 | ```javascript 36 | ev.on('**.**',... 37 | ``` 38 | 39 | ev always emits data, sessionId and the namespace which is helpful to know if there are multiple sessions or you're listening to events from all namespaces. 40 | 41 | ```javascript 42 | ev.on('**.**', (data, sessionId, namespace) => { 43 | 44 | console.log(`${namespace} event detected for session ${sessionId}`, data) 45 | 46 | }); 47 | ``` 48 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/group-metadata/interfaces/GenericGroupChangeEvent.md: -------------------------------------------------------------------------------- 1 | # Interface: GenericGroupChangeEvent 2 | 3 | ## Properties 4 | 5 | ### author 6 | 7 | > **author**: [`Contact`](/reference/api/model/contact/interfaces/Contact.md) 8 | 9 | The contact who triggered this event. (E.g the contact who changed the group picture) 10 | 11 | *** 12 | 13 | ### body 14 | 15 | > **body**: `string` 16 | 17 | Some more information about the event 18 | 19 | *** 20 | 21 | ### groupMetadata 22 | 23 | > **groupMetadata**: [`GroupMetadata`](/reference/api/model/group-metadata/interfaces/GroupMetadata.md) 24 | 25 | *** 26 | 27 | ### groupPic 28 | 29 | > **groupPic**: `string` 30 | 31 | Base 64 encoded image 32 | 33 | *** 34 | 35 | ### id 36 | 37 | > **id**: [`MessageId`](/reference/api/model/aliases/type-aliases/MessageId.md) 38 | 39 | *** 40 | 41 | ### type 42 | 43 | > **type**: `"remove"` \| `"add"` \| `"invite"` \| `"leave"` \| `"subject"` \| `"description"` \| `"announce"` \| `"restrict"` \| `"picutre"` \| `"create"` \| `"delete"` \| `"revoke_invite"` \| `"no_frequently_forwarded"` \| `"announce_msg_bounce"` \| `"demote"` \| `"promote"` \| `"modify"` \| `"v4_add_invite_sent"` \| `"v4_add_invite_join"` \| `"growth_locked"` \| `"growth_unlocked"` \| `"linked_group_join"` 44 | 45 | Type of the event 46 | -------------------------------------------------------------------------------- /docs/docs/how-to/send-videos.md: -------------------------------------------------------------------------------- 1 | # Send Video 2 | 3 | In order to send videos, the client must be started with an instance of chrome! Otherwise videos will be sent as files and not render properly in the app. 4 | 5 | To use chrome set [[useChrome]] (finds the chrome installation automatically) to true or set the [[executablePath]] (set the chrome installation path manually). 6 | 7 | [[useChrome]] takes a few seconds so to save time in consequtive processes set [[executablePath]] ([[useChrome]] will output the valid [[executablePath]] in the logs so keep an eye on them) 8 | 9 | ```javascript 10 | client.sendImage(chatId, dataUrl, 'filename.jpeg', 'cool caption') 11 | 12 | //send image as a reply to another message quotedMessageId 13 | client.sendImage(chatId, dataUrl, 'filename.jpeg', 'cool caption', quotedMessageId) 14 | 15 | //wait for the Id to be returned 16 | client.sendImage(chatId, dataUrl, 'filename.jpeg', 'cool caption', null, true) 17 | 18 | ``` 19 | 20 | Example of config for sending videos: 21 | 22 | ```javascript 23 | create({ 24 | // For Mac: 25 | executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', 26 | // For Windows: 27 | // executablePath: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', 28 | }).then(client => start(client)); 29 | ``` 30 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/index.md: -------------------------------------------------------------------------------- 1 | # api/model/aliases 2 | 3 | ## Index 4 | 5 | ### Type Aliases 6 | 7 | - [AccountNumber](/reference/api/model/aliases/type-aliases/AccountNumber.md) 8 | - [AdvancedFile](/reference/api/model/aliases/type-aliases/AdvancedFile.md) 9 | - [Base64](/reference/api/model/aliases/type-aliases/Base64.md) 10 | - [ChatId](/reference/api/model/aliases/type-aliases/ChatId.md) 11 | - [ChatServer](/reference/api/model/aliases/type-aliases/ChatServer.md) 12 | - [ContactId](/reference/api/model/aliases/type-aliases/ContactId.md) 13 | - [Content](/reference/api/model/aliases/type-aliases/Content.md) 14 | - [CountryCode](/reference/api/model/aliases/type-aliases/CountryCode.md) 15 | - [DataURL](/reference/api/model/aliases/type-aliases/DataURL.md) 16 | - [FilePath](/reference/api/model/aliases/type-aliases/FilePath.md) 17 | - [GetURL](/reference/api/model/aliases/type-aliases/GetURL.md) 18 | - [GroupChatId](/reference/api/model/aliases/type-aliases/GroupChatId.md) 19 | - [GroupChatServer](/reference/api/model/aliases/type-aliases/GroupChatServer.md) 20 | - [GroupId](/reference/api/model/aliases/type-aliases/GroupId.md) 21 | - [MessageId](/reference/api/model/aliases/type-aliases/MessageId.md) 22 | - [NonSerializedId](/reference/api/model/aliases/type-aliases/NonSerializedId.md) 23 | - [WaServers](/reference/api/model/aliases/type-aliases/WaServers.md) 24 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/config/interfaces/Webhook.md: -------------------------------------------------------------------------------- 1 | # Interface: Webhook 2 | 3 | ## Properties 4 | 5 | ### events 6 | 7 | > **events**: [`SimpleListener`](/reference/api/model/events/enumerations/SimpleListener.md)[] 8 | 9 | An array of events that are registered to be sent to this webhook. 10 | 11 | *** 12 | 13 | ### id 14 | 15 | > **id**: `string` 16 | 17 | The ID of the given webhook setup. Use this ID with [[removeWebhook]] 18 | 19 | *** 20 | 21 | ### requestConfig? 22 | 23 | > `optional` **requestConfig**: `AxiosRequestConfig`\<`any`\> 24 | 25 | The optional AxiosRequestConfig to use for firing the webhook event. This can be useful if you want to add some authentication when POSTing data to your server. 26 | 27 | For example, if your webhook requires the username `admin` and password `1234` for authentication, you can set the requestConfig to: 28 | ``` 29 | { 30 | auth: { 31 | username: "admin", 32 | password: "1234", 33 | } 34 | } 35 | ``` 36 | 37 | Please note, for security reasons, this is not returned when listing webhooks however it is returned when registering a webhook for verification purposes. 38 | 39 | *** 40 | 41 | ### ts 42 | 43 | > **ts**: `number` 44 | 45 | Time when the webhook was registered in epoch time 46 | 47 | *** 48 | 49 | ### url 50 | 51 | > **url**: `string` 52 | 53 | The endpoint to send (POST) the event to. 54 | -------------------------------------------------------------------------------- /docs/src/theme/NavbarItem/ComponentTypes.tsx: -------------------------------------------------------------------------------- 1 | import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem'; 2 | import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem'; 3 | import LocaleDropdownNavbarItem from '@theme/NavbarItem/LocaleDropdownNavbarItem'; 4 | import SearchNavbarItem from '@theme/NavbarItem/SearchNavbarItem'; 5 | import HtmlNavbarItem from '@theme/NavbarItem/HtmlNavbarItem'; 6 | import DocNavbarItem from '@theme/NavbarItem/DocNavbarItem'; 7 | import DocSidebarNavbarItem from '@theme/NavbarItem/DocSidebarNavbarItem'; 8 | import DocsVersionNavbarItem from '@theme/NavbarItem/DocsVersionNavbarItem'; 9 | import DocsVersionDropdownNavbarItem from '@theme/NavbarItem/DocsVersionDropdownNavbarItem'; 10 | import {GetLicenseNavBarButton} from '../../components/License/index'; 11 | 12 | import type {ComponentTypesObject} from '@theme/NavbarItem/ComponentTypes'; 13 | 14 | const ComponentTypes: ComponentTypesObject = { 15 | default: DefaultNavbarItem, 16 | localeDropdown: LocaleDropdownNavbarItem, 17 | search: SearchNavbarItem, 18 | dropdown: DropdownNavbarItem, 19 | html: HtmlNavbarItem, 20 | doc: DocNavbarItem, 21 | docSidebar: DocSidebarNavbarItem, 22 | docsVersion: DocsVersionNavbarItem, 23 | docsVersionDropdown: DocsVersionDropdownNavbarItem, 24 | ['custom-glnb']: GetLicenseNavBarButton 25 | }; 26 | 27 | export default ComponentTypes; 28 | -------------------------------------------------------------------------------- /types-only/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@open-wa/wa-automate-types-only", 3 | "version": "4.76.0", 4 | "description": "Types generated from the @open-wa/wa-automate package", 5 | "scripts": { 6 | "build": "tsc", 7 | "deploy": "npm run build && npm version", 8 | "pub": "npm run build && npm run _ver && npm publish", 9 | "_ver": "awk -F'\"' '/\"version\": \".+\"/{ print $4; exit; }' ../package.json | xargs -I{} npm version {} --allow-same-version", 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "types": "dist/index.d.ts", 13 | "keywords": [ 14 | "typescript", 15 | "ts", 16 | "types", 17 | "open-wa", 18 | "wa-automate" 19 | ], 20 | "files": [ 21 | "dist/index.d.ts", 22 | "dist" 23 | ], 24 | "repository": { 25 | "type": "git", 26 | "url": "git+https://github.com/open-wa/wa-automate-nodejs.git" 27 | }, 28 | "author": "Mohammed Shah <@smashah>", 29 | "publishConfig": { 30 | "access": "public" 31 | }, 32 | "license": "H-DNH V1.0", 33 | "bugs": { 34 | "url": "https://github.com/open-wa/wa-automate-nodejs/issues" 35 | }, 36 | "homepage": "https://github.com/open-wa/wa-automate-nodejs#readme", 37 | "engines": { 38 | "node": ">=12.18.3", 39 | "npm": ">=7.9.0" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/call/interfaces/Call.md: -------------------------------------------------------------------------------- 1 | # Interface: Call 2 | 3 | ## Properties 4 | 5 | ### State 6 | 7 | > **State**: [`CallState`](/reference/api/model/call/enumerations/CallState.md) 8 | 9 | State of the call 10 | 11 | *** 12 | 13 | ### canHandleLocally 14 | 15 | > **canHandleLocally**: `boolean` 16 | 17 | *** 18 | 19 | ### id 20 | 21 | > **id**: `string` 22 | 23 | The id of the call 24 | 25 | *** 26 | 27 | ### isGroup 28 | 29 | > **isGroup**: `boolean` 30 | 31 | Whether or not the call is a group call 32 | 33 | *** 34 | 35 | ### isVideo 36 | 37 | > **isVideo**: `boolean` 38 | 39 | Whether or not the call is a video call 40 | 41 | *** 42 | 43 | ### offerTime 44 | 45 | > **offerTime**: `number` 46 | 47 | The epoch timestamp of the call. You will have to multiply this by 1000 to get the actual epoch timestamp 48 | 49 | *** 50 | 51 | ### outgoing 52 | 53 | > **outgoing**: `boolean` 54 | 55 | The direction of the call. 56 | 57 | *** 58 | 59 | ### participants 60 | 61 | > **participants**: [`ContactId`](/reference/api/model/aliases/type-aliases/ContactId.md)[] 62 | 63 | The other participants on a group call 64 | 65 | *** 66 | 67 | ### peerJid 68 | 69 | > **peerJid**: [`ContactId`](/reference/api/model/aliases/type-aliases/ContactId.md) 70 | 71 | The id of the account calling 72 | 73 | *** 74 | 75 | ### webClientShouldHandle 76 | 77 | > **webClientShouldHandle**: `boolean` 78 | -------------------------------------------------------------------------------- /test/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test.todo('Create a client with 0 params') 4 | test.todo('Create a client with 1 params [session id string]') 5 | test.todo('Create a client with 1 params [config only]') 6 | test.todo('Create a client with 2 params') 7 | 8 | /** 9 | * Logout states 10 | */ 11 | test.todo('Restart existing session') 12 | test.todo('Logout and detect logout event') 13 | test.todo('Restart existing session, expect QR code') 14 | test.todo('create fresh session, expect QR code') 15 | test.todo('create fresh session, wait 60 seconds, expect QR code') 16 | 17 | 18 | test.todo('Check if can send message') 19 | test.todo('Check licensed features') 20 | test.todo('Create a client with license') 21 | 22 | 23 | test.todo('Set up 2 accounts. Marco & Polo'); 24 | 25 | /** 26 | * Marco will test sending functions, Polo will test callbacks/events 27 | */ 28 | 29 | test.todo('Received Ack Event') 30 | test.todo('Received State Event') 31 | test.todo('Received AnyMessage Event') 32 | test.todo('Received Battery Event') 33 | test.todo('Received ChatState Event') 34 | test.todo('Received ParticipantChanged Event') 35 | test.todo('Received Message Event') 36 | test.todo('Received Story Event') 37 | 38 | test.todo('Send Text') 39 | test.todo('Send Image') 40 | test.todo('Send Video') 41 | test.todo('Send Location') 42 | test.todo('Send Sticker') 43 | test.todo('Send Instagram link preview') 44 | test.todo('etc..') -------------------------------------------------------------------------------- /docs/docs/reference/api/model/enumerations/Events.md: -------------------------------------------------------------------------------- 1 | # Enumeration: Events 2 | 3 | Events that can be emitted by the client 4 | 5 | ## Enumeration Members 6 | 7 | ### AUTHENTICATED 8 | 9 | > **AUTHENTICATED**: `"authenticated"` 10 | 11 | *** 12 | 13 | ### AUTHENTICATION\_FAILURE 14 | 15 | > **AUTHENTICATION\_FAILURE**: `"auth_failure"` 16 | 17 | *** 18 | 19 | ### DISCONNECTED 20 | 21 | > **DISCONNECTED**: `"disconnected"` 22 | 23 | *** 24 | 25 | ### GROUP\_JOIN 26 | 27 | > **GROUP\_JOIN**: `"group_join"` 28 | 29 | *** 30 | 31 | ### GROUP\_LEAVE 32 | 33 | > **GROUP\_LEAVE**: `"group_leave"` 34 | 35 | *** 36 | 37 | ### GROUP\_UPDATE 38 | 39 | > **GROUP\_UPDATE**: `"group_update"` 40 | 41 | *** 42 | 43 | ### MESSAGE\_ACK 44 | 45 | > **MESSAGE\_ACK**: `"message_ack"` 46 | 47 | *** 48 | 49 | ### MESSAGE\_CREATE 50 | 51 | > **MESSAGE\_CREATE**: `"message_create"` 52 | 53 | *** 54 | 55 | ### MESSAGE\_RECEIVED 56 | 57 | > **MESSAGE\_RECEIVED**: `"message"` 58 | 59 | *** 60 | 61 | ### MESSAGE\_REVOKED\_EVERYONE 62 | 63 | > **MESSAGE\_REVOKED\_EVERYONE**: `"message_revoke_everyone"` 64 | 65 | *** 66 | 67 | ### MESSAGE\_REVOKED\_ME 68 | 69 | > **MESSAGE\_REVOKED\_ME**: `"message_revoke_me"` 70 | 71 | *** 72 | 73 | ### QR\_RECEIVED 74 | 75 | > **QR\_RECEIVED**: `"qr"` 76 | 77 | *** 78 | 79 | ### READY 80 | 81 | > **READY**: `"ready"` 82 | 83 | *** 84 | 85 | ### STATE\_CHANGED 86 | 87 | > **STATE\_CHANGED**: `"change_state"` 88 | -------------------------------------------------------------------------------- /src/api/model/call.ts: -------------------------------------------------------------------------------- 1 | import { ContactId } from "./aliases"; 2 | 3 | export enum CallState { 4 | INCOMING_RING= "INCOMING_RING", 5 | OUTGOING_RING= "OUTGOING_RING", 6 | OUTGOING_CALLING= "OUTGOING_CALLING", 7 | CONNECTING= "CONNECTING", 8 | CONNECTION_LOST= "CONNECTION_LOST", 9 | ACTIVE= "ACTIVE", 10 | HANDLED_REMOTELY= "HANDLED_REMOTELY", 11 | ENDED= "ENDED", 12 | REJECTED= "REJECTED", 13 | REMOTE_CALL_IN_PROGRESS= "REMOTE_CALL_IN_PROGRESS", 14 | FAILED= "FAILED", 15 | NOT_ANSWERED= "NOT_ANSWERED" 16 | } 17 | 18 | export interface Call { 19 | /** 20 | * The id of the call 21 | */ 22 | id: string; 23 | /** 24 | * The id of the account calling 25 | */ 26 | peerJid: ContactId; 27 | /** 28 | * The epoch timestamp of the call. You will have to multiply this by 1000 to get the actual epoch timestamp 29 | */ 30 | offerTime: number; 31 | /** 32 | * Whether or not the call is a video call 33 | */ 34 | isVideo: boolean; 35 | /** 36 | * Whether or not the call is a group call 37 | */ 38 | isGroup: boolean; 39 | canHandleLocally: boolean; 40 | /** 41 | * The direction of the call. 42 | */ 43 | outgoing: boolean; 44 | webClientShouldHandle: boolean; 45 | /** 46 | * The other participants on a group call 47 | */ 48 | participants: ContactId[] 49 | /** 50 | * State of the call 51 | */ 52 | State: CallState 53 | } -------------------------------------------------------------------------------- /docs/docs/reference/api/model/media/type-aliases/Mp4StickerConversionProcessOptions.md: -------------------------------------------------------------------------------- 1 | # Type Alias: Mp4StickerConversionProcessOptions 2 | 3 | > **Mp4StickerConversionProcessOptions**: `object` 4 | 5 | ## Type declaration 6 | 7 | ### crop? 8 | 9 | > `optional` **crop**: `boolean` 10 | 11 | Centres and crops the video. 12 | default `true` 13 | 14 | ### endTime? 15 | 16 | > `optional` **endTime**: `string` 17 | 18 | The video end time of the sticker. By default, stickers are made from the first 5 seconds of the video 19 | 20 | #### Default 21 | 22 | `00:00:05.0` 23 | 24 | ### fps? 25 | 26 | > `optional` **fps**: `number` 27 | 28 | Desired Frames per second of the sticker output 29 | 30 | #### Default 31 | 32 | `10` 33 | 34 | ### log? 35 | 36 | > `optional` **log**: `boolean` 37 | 38 | Prints ffmpeg logs in the terminal 39 | 40 | #### Default 41 | 42 | `false` 43 | 44 | ### loop? 45 | 46 | > `optional` **loop**: `number` 47 | 48 | The amount of times the video loops in the sticker. To save processing time, leave this as 0 49 | default `0` 50 | 51 | ### square? 52 | 53 | > `optional` **square**: `number` 54 | 55 | A number representing the WxH of the output sticker (default `512x512`). Lowering this number is a great way to process longer duration stickers. The max value is `512`. 56 | default `512` 57 | 58 | ### startTime? 59 | 60 | > `optional` **startTime**: `string` 61 | 62 | The video start time of the sticker 63 | 64 | #### Default 65 | 66 | `00:00:00.0` 67 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/product/interfaces/CustomProduct.md: -------------------------------------------------------------------------------- 1 | # Interface: CustomProduct 2 | 3 | ## Properties 4 | 5 | ### currency 6 | 7 | > **currency**: `string` 8 | 9 | The [**ISO 4217**](https://en.wikipedia.org/wiki/ISO_4217) 3 letter currency code. E.g (Swedish krona) 10 | `SEK` 11 | 12 | *** 13 | 14 | ### description 15 | 16 | > **description**: `string` 17 | 18 | The description of the product. This shows right under the price so it is useful for subscriptions/rentals. E.g: 19 | 20 | `(per day)\n\nCome and have a fantastic sailing adventure aboard our boat. \nShe is a Bavaria 35 sports cruiser and is powered by 2 economical Volvo D6’s with Bravo 2 outdrives as well as a bow thruster. This Makes maneuvering very easy. She can accommodate up to 8 people for day charters and for overnight charters she can accommodate 4 in comfort in 2 cabins.` 21 | 22 | *** 23 | 24 | ### name 25 | 26 | > **name**: `string` 27 | 28 | The main title of the product. E.g: 29 | `BAVARIA — 35 SPORTS CRUISER (2006)` 30 | 31 | *** 32 | 33 | ### priceAmount1000 34 | 35 | > **priceAmount1000**: `number` 36 | 37 | The price amount multiplied by 1000. For example, for something costing `825` units of currency: 38 | `825000` 39 | 40 | *** 41 | 42 | ### url? 43 | 44 | > `optional` **url**: `string` 45 | 46 | The URL of the product. 47 | 48 | NOTE: At the moment, the URL DOES NOT WORK. It shows up for the recipient but they will not be able to click it. As a rememdy, it is added as a reply to the product message. 49 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/interfaces/ReactionSender.md: -------------------------------------------------------------------------------- 1 | # Interface: ReactionSender 2 | 3 | ## Properties 4 | 5 | ### ack? 6 | 7 | > `optional` **ack**: `number` 8 | 9 | *** 10 | 11 | ### id 12 | 13 | > **id**: [`MessageId`](/reference/api/model/aliases/type-aliases/MessageId.md) 14 | 15 | The message ID of the reaction itself 16 | 17 | *** 18 | 19 | ### isSendFailure 20 | 21 | > **isSendFailure**: `boolean` 22 | 23 | *** 24 | 25 | ### msgKey 26 | 27 | > **msgKey**: [`MessageId`](/reference/api/model/aliases/type-aliases/MessageId.md) 28 | 29 | The message ID of the reaction itself 30 | 31 | *** 32 | 33 | ### orphan 34 | 35 | > **orphan**: `number` 36 | 37 | *** 38 | 39 | ### parentMsgKey 40 | 41 | > **parentMsgKey**: [`MessageId`](/reference/api/model/aliases/type-aliases/MessageId.md) 42 | 43 | The ID of the message being reacted to 44 | 45 | *** 46 | 47 | ### reactionText 48 | 49 | > **reactionText**: `string` 50 | 51 | The text of the reaction 52 | 53 | *** 54 | 55 | ### read 56 | 57 | > **read**: `boolean` 58 | 59 | If the reaction was seen/read 60 | 61 | *** 62 | 63 | ### senderUserJid 64 | 65 | > **senderUserJid**: [`ContactId`](/reference/api/model/aliases/type-aliases/ContactId.md) 66 | 67 | The contact ID of the sender of the reaction 68 | 69 | *** 70 | 71 | ### t? 72 | 73 | > `optional` **t**: `number` 74 | 75 | The timestamp of the reaction 76 | 77 | *** 78 | 79 | ### timestamp 80 | 81 | > **timestamp**: `number` 82 | 83 | The timestamp of the reaction 84 | -------------------------------------------------------------------------------- /docs/docs/how-to/misc.md: -------------------------------------------------------------------------------- 1 | # More examples 2 | 3 | ## Simulate typing 4 | 5 | As of version 1.3.1 you can now simulate '...typing' 6 | 7 | You need to pass the following params: 8 | 9 | - chat id: xxxxx@c.us 10 | - on: true or false 11 | 12 | Note: You need to manually turn this off!!! 13 | 14 | ```javascript 15 | //start '...typing' 16 | await client.simulateTyping('xxxxx@c.us',true) 17 | //wait 3 seconds 18 | 19 | //stop '...typing' 20 | await client.simulateTyping('xxxxx@c.us',false) 21 | ``` 22 | 23 | ## Load profile pics from server 24 | 25 | Generally, after the 20th chat in your WA, getChat methods do not retreive the chat picture. You need to get these from the WA servers. This is how you do it in v1.6.6^: 26 | 27 | ```javascript 28 | client.getProfilePicFromServer('XXXXXXX-YYYYY@c.us') 29 | ``` 30 | 31 | ## Listen to Read Receipts 32 | 33 | As of version 1.5.3 you can now listen in on the read state (or technically acknowledgement state) of the messages. As of writing the limitation is presumed to be on sent messages. 34 | 35 | The callback you set returns the whole raw message object. 36 | 37 | Here's how you do it. 38 | 39 | ```javascript 40 | client.onAck((msg:any) => console.log(msg.id.toString(),msg.body,msg.ack)) 41 | ``` 42 | 43 | ack represents the acknoledgement state, of which there are 3. 44 | 45 | ```javascript 46 | 1 => Message Sent (1 tick) 47 | 48 | 2 => Message Received by Recipient (2 ticks) 49 | 50 | 3 => Message Read Receipt Confirmed (2 blue ticks) 51 | ``` 52 | 53 | Note: You won't get 3 if the recipient has read receipts off. 54 | -------------------------------------------------------------------------------- /docs/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import clsx from 'clsx'; 2 | import Link from '@docusaurus/Link'; 3 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 4 | import Layout from '@theme/Layout'; 5 | import HomepageFeatures from '@site/src/components/HomepageFeatures'; 6 | import Heading from '@theme/Heading'; 7 | import { CookieConsent } from "../components/Consent"; 8 | 9 | import styles from './index.module.css'; 10 | 11 | function HomepageHeader() { 12 | const {siteConfig} = useDocusaurusContext(); 13 | return ( 14 |
15 |
16 | 17 | {siteConfig.title} 18 | 19 |

{siteConfig.tagline}

20 |
21 | 24 | See all Features ⏩ 25 | 26 |
27 |
28 |
29 | ); 30 | } 31 | 32 | export default function Home(): JSX.Element { 33 | const {siteConfig} = useDocusaurusContext(); 34 | return ( 35 | 38 | 39 | 40 |
41 | 42 |
43 |
44 | ); 45 | } 46 | -------------------------------------------------------------------------------- /docs/docs/how-to/send-messages.md: -------------------------------------------------------------------------------- 1 | # Sending Messages 2 | 3 | When sending a message, make sure to await the promise. It usually returns an id if the message was sent successfully. 4 | 5 | ## Send a basic message 6 | 7 | [[sendText]] 8 | 9 | ```javascript 10 | await client.sendText(chatId, "Hello"); 11 | ``` 12 | 13 | ## Send a message with mentions 14 | 15 | [[sendTextWithMentions]] 16 | 17 | ```javascript 18 | await client.sendTextWithMentions(chatId, "Hello"); 19 | ``` 20 | 21 | ## Send a reply 22 | 23 | [[reply]] 24 | 25 | ```javascript 26 | await client.reply(chatId, "Hello", idOfMessageToReplyTo); 27 | 28 | // set the fourth variable to true to set the chat to 'seen' 29 | await client.reply(chatId, "Hello", idOfMessageToReplyTo, true); 30 | ``` 31 | 32 | ## Send a reply with mentions 33 | 34 | [[sendReplyWithMentions]] 35 | 36 | ```javascript 37 | await client.sendReplyWithMentions(chatId, "Hello", idOfMessageToReplyTo); 38 | ``` 39 | 40 | ## Forward Messages 41 | 42 | To forward messages use [[forwardMessages]] with the following params: 43 | 44 | - chat to forward messages to : xxxxx@c.us 45 | - messages: a single or array of message ids or message objects 46 | - skipMyMessages: true or false, if true it will filter out messages sent by you from the list of messages, default false. 47 | 48 | ```javascript 49 | //forward multiple messages using an array of messageIds 50 | await client.forwardMessages('xxxxx@c.us',[Array of Message Ids],true) 51 | 52 | //forward single message by id 53 | await client.forwardMessages('xxxxx@c.us,"messageId",true) 54 | ``` 55 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/message/interfaces/PollVote.md: -------------------------------------------------------------------------------- 1 | # Interface: PollVote 2 | 3 | ## Properties 4 | 5 | ### ack 6 | 7 | > **ack**: `number` 8 | 9 | *** 10 | 11 | ### id 12 | 13 | > **id**: `string` 14 | 15 | The message ID of this vote. For some reason this is different from the msgKey and includes exclamaition marks. 16 | 17 | *** 18 | 19 | ### msgKey 20 | 21 | > **msgKey**: `string` 22 | 23 | The message key of this vote 24 | 25 | *** 26 | 27 | ### parentMsgKey 28 | 29 | > **parentMsgKey**: `string` 30 | 31 | The Message ID of the original Poll message 32 | 33 | *** 34 | 35 | ### pollOptions 36 | 37 | > **pollOptions**: [`PollOption`](/reference/api/model/message/interfaces/PollOption.md)[] 38 | 39 | The original poll options available on the poll 40 | 41 | *** 42 | 43 | ### selectedOptionLocalIds 44 | 45 | > **selectedOptionLocalIds**: `number`[] 46 | 47 | The selected option IDs of the voter 48 | 49 | *** 50 | 51 | ### selectedOptionValues 52 | 53 | > **selectedOptionValues**: `string`[] 54 | 55 | The selected option values by this voter 56 | 57 | *** 58 | 59 | ### sender 60 | 61 | > **sender**: [`ContactId`](/reference/api/model/aliases/type-aliases/ContactId.md) 62 | 63 | The contact ID of the voter 64 | 65 | *** 66 | 67 | ### senderObj 68 | 69 | > **senderObj**: [`Contact`](/reference/api/model/contact/interfaces/Contact.md) 70 | 71 | The contact object of the voter 72 | 73 | *** 74 | 75 | ### senderTimestampMs 76 | 77 | > **senderTimestampMs**: `number` 78 | 79 | Timestamp of the vote 80 | 81 | *** 82 | 83 | ### stale 84 | 85 | > **stale**: `boolean` 86 | -------------------------------------------------------------------------------- /src/cli/file-utils.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import * as fs from 'fs'; 3 | import JSON5 from 'json5'; 4 | import { log } from '../logging/logging'; 5 | 6 | export const tryOpenFileAsObject : (fileLocation: string, needArray ?: boolean) => Promise = async (fileLocation : string , needArray = false) => { 7 | let res = undefined; 8 | let fp = undefined; 9 | const relativePath = path.join(path.resolve(process.cwd(), fileLocation || '')); 10 | const isJs = fileLocation.endsWith(".js") 11 | log.info(`Checking exists: ${fileLocation || relativePath}`); 12 | if (fs.existsSync(fileLocation) || fs.existsSync(relativePath)) { 13 | fp = isJs ? fs.existsSync(relativePath) && relativePath : fs.existsSync(fileLocation) ? fileLocation : relativePath; 14 | log.info("Attempting to open: " + fp); 15 | try { 16 | const data = isJs ? (require(fp) || {}).default : JSON5.parse(fs.readFileSync(fp, 'utf8')); 17 | if (data && (Array.isArray(data) == needArray)) res = data; 18 | if(data && typeof data === "function") { 19 | log.info("Found config as function, executing.") 20 | res = await data(process.env.CURRENT_SESSION_ID || "session") 21 | } 22 | } catch (error) { 23 | throw `Unable to parse config file as JSON. Please make sure ${fp} is a valid JSON config file`; 24 | } 25 | } else return 26 | log.info(`${fp} is ${res ? 'valid' : 'invalid'}`); 27 | log.info(`contents: ${JSON.stringify(res)}`); 28 | return res && { 29 | ...(res || {}), 30 | confPath: fp 31 | }; 32 | } -------------------------------------------------------------------------------- /docs/docs/reference/structures/preProcessors/enumerations/PREPROCESSORS.md: -------------------------------------------------------------------------------- 1 | # Enumeration: PREPROCESSORS 2 | 3 | A set of easy to use, built-in message processors. 4 | 5 | [Check out the processor code here](https://github.com/open-wa/wa-automate-nodejs/blob/master/src/structures/preProcessors.ts) 6 | 7 | ## Enumeration Members 8 | 9 | ### AUTO\_DECRYPT 10 | 11 | > **AUTO\_DECRYPT**: `"AUTO_DECRYPT"` 12 | 13 | Replaces the media thumbnail base64 in `body` with the actual file's DataURL. 14 | 15 | *** 16 | 17 | ### AUTO\_DECRYPT\_SAVE 18 | 19 | > **AUTO\_DECRYPT\_SAVE**: `"AUTO_DECRYPT_SAVE"` 20 | 21 | Automatically saves the file in a folder named `/media` relative to the process working directory. 22 | 23 | PLEASE NOTE, YOU WILL NEED TO MANUALLY CLEAR THIS FOLDER!!! 24 | 25 | *** 26 | 27 | ### BODY\_ONLY 28 | 29 | > **BODY\_ONLY**: `"BODY_ONLY"` 30 | 31 | A preprocessor that limits the amount of base64 data is present in the message object by removing duplication of `body` in `content` by replacing `content` with `""`. 32 | 33 | *** 34 | 35 | ### SCRUB 36 | 37 | > **SCRUB**: `"SCRUB"` 38 | 39 | This preprocessor scrubs `body` and `content` from media messages. 40 | This would be useful if you want to reduce the message object size because neither of these values represent the actual file, only the thumbnail. 41 | 42 | *** 43 | 44 | ### UPLOAD\_CLOUD 45 | 46 | > **UPLOAD\_CLOUD**: `"UPLOAD_CLOUD"` 47 | 48 | Uploads file to a cloud storage provider (GCP/AWS for now). 49 | 50 | If this preprocessor is set then you have to also set [`cloudUploadOptions`](https://docs.openwa.dev/docs/reference/api/model/config/interfaces/ConfigObject#clouduploadoptions) in the config. 51 | -------------------------------------------------------------------------------- /docs/docs/Integrations/chatwoot.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Chatwoot integrations 3 | description: ready made integration for chatwoot. 4 | --- 5 | 6 | you can directly integrate open-wa/wa-automate directly using the easy-api or docker 7 | 8 | - before you start you need to have below details from chatwoot 9 | 10 | | item | description | example | 11 | | ------------ | ------------ | ------------ | 12 | | chatwoot API URL |it can be self-hosted or chatwoot hosted |for self-hosted `http://localhost:3000` and can be` https://app.chatwoot.com/platform/api/v1` for chatwoot hosted| 13 | |chatwoot access token | you can get it at the end of your chatwoot profile page | for example `5lUC0KdzAl8iZO5aLsZHdx0i9rRix6qd` | 14 | |`optional` full chatwoot API URL | if you want to use an existing chatwoot inbox | the URL will look like this `https://app.chatwoot.com/accounts/[account id]/inboxes/[inbox id]` | 15 | 16 | - if you want easy-api to automatically generate chatwoot inbox and configure it 17 | 18 | `npx @open-wa/wa-automate -p [port number] -k "your easy-api API Key" --verbose --force-update-cw-webhook --chatwoot-url "https://app.chatwoot.com/platform/api/v1" --chatwoot-api-access-token "your chatwoot access token"` 19 | 20 | - if you wan't to use and already generated inbox which was created using the above command then you need to provide the full chatwoot API URL which has the account ID and inbox id details. 21 | 22 | `npx @open-wa/wa-automate -p [port number] -k "your easy-api API Key" --verbose --force-update-cw-webhook --chatwoot-url "https://app.chatwoot.com/accounts/[account id]/inboxes/[inbox id]" --chatwoot-api-access-token "your chatwoot access token"` 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/controllers/script_preloader.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import * as fs from 'fs'; 3 | import { log } from '../logging/logging'; 4 | 5 | const read : (_path) => Promise = (_path) => new Promise((resolve, reject) => { 6 | fs.readFile(require.resolve(path.join(__dirname, '../lib', _path)), 'utf8', (err, file) => { 7 | if (err) reject(err) 8 | resolve(file as string) 9 | }) 10 | }) 11 | 12 | export class ScriptLoader { 13 | scripts = [ 14 | // stage 1 15 | 'jsSha.min.js', 16 | 'qr.min.js', 17 | 'base64.js', 18 | 'hash.js', 19 | //stage 2 20 | 'wapi.js', 21 | //stage 3, 22 | 'launch.js' 23 | ] 24 | contentRegistry: { 25 | [key: string]: string; 26 | } = {} 27 | 28 | constructor() { 29 | this.contentRegistry = {} 30 | } 31 | 32 | async loadScripts() { 33 | await Promise.all(this.scripts.map(this.getScript.bind(this))); 34 | return this.contentRegistry; 35 | } 36 | 37 | async getScript(scriptName: string) { 38 | if (!this.contentRegistry[scriptName]) { 39 | this.contentRegistry[scriptName] = await read(scriptName); 40 | log.info(`SCRIPT READY: ${scriptName} ${this.contentRegistry[scriptName].length}`); 41 | } else log.info(`GET SCRIPT: ${scriptName} ${this.contentRegistry[scriptName].length}`); 42 | return this.contentRegistry[scriptName]; 43 | } 44 | 45 | flush() { 46 | this.contentRegistry = {} 47 | } 48 | 49 | getScripts() { 50 | return this.contentRegistry; 51 | } 52 | } 53 | 54 | const scriptLoader = new ScriptLoader(); 55 | export {scriptLoader}; -------------------------------------------------------------------------------- /docs/docs/get-started/link-code.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Logging in with a link code 3 | sidebar_label: Link Code Login 4 | sidebar_position: 3 5 | description: 6 | Simple docs showing how to use open-wa/wa-automate with a link code. 7 | --- 8 | 9 | # Intro 10 | 11 | For many years the standard way to login to your host account was to scan a QR code. However, recently link code has been introduced as an option. This guide will show you how to use the link code to login to your host account. 12 | 13 | The main thing to know is that you will need to know exactly which host account number you're using before starting the session. This is because the link code is specific to the host account number. 14 | 15 | Once the link code is requested from the session, the host account device will be sent a notification to confirm the login. Once confirmed, the host account device will ask you to enter the link code. 16 | 17 | The link code is a 8 character string that is displayed on the screen of the host account device with a `-` in between, for example: `1EV4-5A78`. 18 | 19 | In open-wa, the way to activate the link code request is to set the host account number as a string or number beforehand as a property of the config object in the `linkCode` property. 20 | 21 | ## Easy API 22 | 23 | If you're using the Easy API, you can set the link code in the config object like so: 24 | 25 | ```bash 26 | > npx @open-wa/wa-automate --link-code '447123456789' 27 | ``` 28 | 29 | Or if you're using the `cli.config.json` file: 30 | 31 | ```json 32 | { 33 | "linkCode": "447123456789" 34 | } 35 | ``` 36 | 37 | ## In code 38 | 39 | You can also set the link code manually in the code like so: 40 | 41 | ```javascript 42 | create({ 43 | linkCode: '447123456789' 44 | }) 45 | ``` -------------------------------------------------------------------------------- /docs/docs/reference/api/model/contact/interfaces/BusinessHours.md: -------------------------------------------------------------------------------- 1 | # Interface: BusinessHours 2 | 3 | ## Properties 4 | 5 | ### config 6 | 7 | > **config**: `object` 8 | 9 | #### fri 10 | 11 | > **fri**: `object` 12 | 13 | #### fri.hours 14 | 15 | > **hours**: `number`[][] 16 | 17 | #### fri.mode 18 | 19 | > **mode**: `"specific_hours"` \| `"open_24h"` \| `"appointment_only"` 20 | 21 | #### mon 22 | 23 | > **mon**: `object` 24 | 25 | #### mon.hours 26 | 27 | > **hours**: `number`[][] 28 | 29 | #### mon.mode 30 | 31 | > **mode**: `"specific_hours"` \| `"open_24h"` \| `"appointment_only"` 32 | 33 | #### sat 34 | 35 | > **sat**: `object` 36 | 37 | #### sat.hours 38 | 39 | > **hours**: `number`[][] 40 | 41 | #### sat.mode 42 | 43 | > **mode**: `"specific_hours"` \| `"open_24h"` \| `"appointment_only"` 44 | 45 | #### sun 46 | 47 | > **sun**: `object` 48 | 49 | #### sun.hours 50 | 51 | > **hours**: `number`[][] 52 | 53 | #### sun.mode 54 | 55 | > **mode**: `"specific_hours"` \| `"open_24h"` \| `"appointment_only"` 56 | 57 | #### thu 58 | 59 | > **thu**: `object` 60 | 61 | #### thu.hours 62 | 63 | > **hours**: `number`[][] 64 | 65 | #### thu.mode 66 | 67 | > **mode**: `"specific_hours"` \| `"open_24h"` \| `"appointment_only"` 68 | 69 | #### tue 70 | 71 | > **tue**: `object` 72 | 73 | #### tue.hours 74 | 75 | > **hours**: `number`[][] 76 | 77 | #### tue.mode 78 | 79 | > **mode**: `"specific_hours"` \| `"open_24h"` \| `"appointment_only"` 80 | 81 | #### wed 82 | 83 | > **wed**: `object` 84 | 85 | #### wed.hours 86 | 87 | > **hours**: `number`[][] 88 | 89 | #### wed.mode 90 | 91 | > **mode**: `"specific_hours"` \| `"open_24h"` \| `"appointment_only"` 92 | 93 | *** 94 | 95 | ### timezone 96 | 97 | > **timezone**: `string` 98 | -------------------------------------------------------------------------------- /docs/static/js/gumroad_docusaurus_cart_fix.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Breaks license popup code in desktop client docs page 3 | */ 4 | 5 | //TODO: only run this code on mobile 6 | 7 | // document.addEventListener("DOMContentLoaded", function(event) { 8 | // if(!window.grObserver) { 9 | // window.grObserver = new MutationObserver((mutationList, observer) => { 10 | // for (const mutation of mutationList) { 11 | // if(mutation.type === "childList" && mutation.addedNodes && [...mutation.addedNodes].find(node=>node.className==="gumroad")) { 12 | // window.grObserver.disconnect(); 13 | // const grNode = [...mutation.addedNodes].find(node=>node.className==="gumroad") 14 | // const cartbtn = grNode.getElementsByClassName('cart-button')[0] 15 | // grNode.style.position = cartbtn.style.position = 'unset' 16 | // const isMobile = !!document.getElementsByClassName('menu__list').length 17 | // const addTo = document.getElementsByClassName('menu__list')[0] || document.getElementsByClassName("navbar__items navbar__items--right")[0] 18 | // if(isMobile) { 19 | // addTo.appendChild(grNode); 20 | // grNode.style.padding = '16px' 21 | // grNode.style.width = cartbtn.style.width = '-webkit-fill-available' 22 | // } 23 | // else addTo.insertBefore(grNode,document.getElementsByClassName('DocSearch DocSearch-Button')[0].parentElement) 24 | // } 25 | // } 26 | // }) 27 | // window.grObserver.observe(document.body, {childList: true }); 28 | // } 29 | // }); 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/sessionInfo/interfaces/SessionInfo.md: -------------------------------------------------------------------------------- 1 | # Interface: SessionInfo 2 | 3 | ## Properties 4 | 5 | ### ACC\_TYPE? 6 | 7 | > `optional` **ACC\_TYPE**: `"PERSONAL"` \| `"BUSINESS"` 8 | 9 | *** 10 | 11 | ### BROWSER\_VERSION 12 | 13 | > **BROWSER\_VERSION**: `string` 14 | 15 | *** 16 | 17 | ### CLI? 18 | 19 | > `optional` **CLI**: `boolean` 20 | 21 | *** 22 | 23 | ### INSTANCE\_ID? 24 | 25 | > `optional` **INSTANCE\_ID**: `string` 26 | 27 | *** 28 | 29 | ### LATEST\_VERSION? 30 | 31 | > `optional` **LATEST\_VERSION**: `boolean` 32 | 33 | *** 34 | 35 | ### LAUNCH\_TIME\_MS? 36 | 37 | > `optional` **LAUNCH\_TIME\_MS**: `number` 38 | 39 | *** 40 | 41 | ### NUM? 42 | 43 | > `optional` **NUM**: `string` 44 | 45 | *** 46 | 47 | ### NUM\_HASH? 48 | 49 | > `optional` **NUM\_HASH**: `string` 50 | 51 | *** 52 | 53 | ### OS? 54 | 55 | > `optional` **OS**: `string` 56 | 57 | *** 58 | 59 | ### OW\_KEY? 60 | 61 | > `optional` **OW\_KEY**: `string` 62 | 63 | *** 64 | 65 | ### PAGE\_UA 66 | 67 | > **PAGE\_UA**: `string` 68 | 69 | *** 70 | 71 | ### PATCH\_HASH? 72 | 73 | > `optional` **PATCH\_HASH**: `string` 74 | 75 | *** 76 | 77 | ### PHONE\_VERSION? 78 | 79 | > `optional` **PHONE\_VERSION**: `string` 80 | 81 | *** 82 | 83 | ### PPTR\_VERSION? 84 | 85 | > `optional` **PPTR\_VERSION**: `string` 86 | 87 | *** 88 | 89 | ### RAM\_INFO? 90 | 91 | > `optional` **RAM\_INFO**: `string` 92 | 93 | *** 94 | 95 | ### START\_TS? 96 | 97 | > `optional` **START\_TS**: `number` 98 | 99 | *** 100 | 101 | ### WA\_AUTOMATE\_VERSION 102 | 103 | > **WA\_AUTOMATE\_VERSION**: `string` 104 | 105 | *** 106 | 107 | ### WA\_VERSION 108 | 109 | > **WA\_VERSION**: `string` 110 | -------------------------------------------------------------------------------- /docs/docs/api/index.md: -------------------------------------------------------------------------------- 1 | # @open-wa/wa-automate v4.71.15 2 | 3 | ## Modules 4 | 5 | - [api/Client](/api/api/Client/index.md) 6 | - [api/functions/exposed.enum](/api/api/functions/exposed.enum/index.md) 7 | - [api/model](/api/api/model/index.md) 8 | - [api/model/aliases](/api/api/model/aliases/index.md) 9 | - [api/model/button](/api/api/model/button/index.md) 10 | - [api/model/call](/api/api/model/call/index.md) 11 | - [api/model/chat](/api/api/model/chat/index.md) 12 | - [api/model/config](/api/api/model/config/index.md) 13 | - [api/model/contact](/api/api/model/contact/index.md) 14 | - [api/model/errors](/api/api/model/errors/index.md) 15 | - [api/model/events](/api/api/model/events/index.md) 16 | - [api/model/group-metadata](/api/api/model/group-metadata/index.md) 17 | - [api/model/id](/api/api/model/id/index.md) 18 | - [api/model/label](/api/api/model/label/index.md) 19 | - [api/model/media](/api/api/model/media/index.md) 20 | - [api/model/message](/api/api/model/message/index.md) 21 | - [api/model/product](/api/api/model/product/index.md) 22 | - [api/model/reactions](/api/api/model/reactions/index.md) 23 | - [api/model/sessionInfo](/api/api/model/sessionInfo/index.md) 24 | - [controllers/events](/api/controllers/events/index.md) 25 | - [controllers/init\_patch](/api/controllers/init_patch/index.md) 26 | - [controllers/initializer](/api/controllers/initializer/index.md) 27 | - [controllers/patch\_manager](/api/controllers/patch_manager/index.md) 28 | - [logging/custom\_transport](/api/logging/custom_transport/index.md) 29 | - [logging/logging](/api/logging/logging/index.md) 30 | - [structures/Collector](/api/structures/Collector/index.md) 31 | - [structures/Dialog](/api/structures/Dialog/index.md) 32 | - [structures/MessageCollector](/api/structures/MessageCollector/index.md) 33 | - [structures/preProcessors](/api/structures/preProcessors/index.md) 34 | -------------------------------------------------------------------------------- /docs/docs/get-started/docker.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Get started with wa-automate via Docker 3 | sidebar_label: Docker 4 | sidebar_position: 1 5 | description: 6 | Guide showing how to use wa-automate with Docker. This also covers how to import 7 | data as well as persistence. 8 | --- 9 | 10 | open-wa has universal images on 11 | [Docker Hub]({@dockerUrl@}). 12 | 13 | ## Prerequisites 14 | 15 | Make sure you have docker installed on your system and are not using a Apple silicon chip. Due to the lack of an ARM compatibile Google Chrome, the docker container does not run on ARM machines. 16 | 17 | ## Run the container (EASY API) 18 | 19 | You can use the following docker command as a drop-in replacement for the normal CLI command (`npx @open-wa/wa-automate`). This means you can use CLI flags normally right after `docker run openwa/wa-automate`. The below example runs the library in socket mode. 20 | 21 | ```bash 22 | > docker run openwa/wa-automate --socket 23 | ``` 24 | 25 | The docker image already has some defaults that do not need to be set via additional CLI flags. 26 | 27 | ## Using the docker image with your own code 28 | 29 | You can extend the docker image and use it as a base for your own custom project. This is useful so you don't have to worry about dependencies. The image is optimised and slimmed out to prevent needless bloat. 30 | 31 | First thing you need to do is to override the `ENTRYPOINT` of the base docker image by adding the line `ENTRYPOINT []` 32 | 33 | ```Dockerfile 34 | FROM openwa/wa-automate 35 | ENTRYPOINT [] 36 | 37 | # Now you can add your custom docker commands 38 | ``` 39 | 40 | After the above, add your custom docker commands to `COPY` your custom code into the image and then `RUN` it at the end. 41 | 42 | Both methods are explained in the [`@open-wa/wa-automate-docker`](https://github.com/open-wa/wa-automate-docker) repository. -------------------------------------------------------------------------------- /demo/simple_server.ts: -------------------------------------------------------------------------------- 1 | //Please see these docs: https://open-wa.github.io/wa-automate-nodejs/classes/client.html#middleware 2 | 3 | // import { create, Client } from '@open-wa/wa-automate'; 4 | import { create, Client } from '../src/index'; 5 | const axios = require('axios').default; 6 | 7 | const { default: PQueue } = require("p-queue"); 8 | const queue = new PQueue({ concurrency: 5 }); 9 | 10 | const express = require('express'); 11 | const app = express(); 12 | app.use(express.json()); 13 | const PORT = 8082; 14 | 15 | //Create your webhook here: https://webhook.site/ 16 | const WEBHOOK_ADDRESS = 'PASTE_WEBHOOK_DOT_SITE_UNIQUE_URL_HERE' 17 | 18 | async function fire(data){ 19 | return await axios.post(WEBHOOK_ADDRESS, data) 20 | } 21 | 22 | const wh = event => async (data) => { 23 | const ts = Date.now(); 24 | return await queue.add(()=>fire({ 25 | ts, 26 | event, 27 | data 28 | })) 29 | } 30 | 31 | async function start(client:Client){ 32 | app.use(client.middleware); 33 | client.onAck(wh('ack')) 34 | client.onAnyMessage(wh('any_message')) 35 | client.onMessage(wh('message')) 36 | 37 | //requires a group id 38 | // client.onParticipantsChanged(wh('message')) 39 | client.onAddedToGroup(wh('added_to_group')) 40 | client.onBattery(wh('battery')) 41 | client.onContactAdded(wh('contact_added')) 42 | client.onIncomingCall(wh('incoming_call')) 43 | client.onPlugged(wh('plugged')) 44 | client.onStateChanged(wh('state')) 45 | 46 | //this is only for insiders 47 | client.onRemovedFromGroup(wh('removed_from_group')) 48 | 49 | app.listen(PORT, function () { 50 | console.log(`\n• Listening on port ${PORT}!`); 51 | }); 52 | } 53 | 54 | create({ 55 | sessionId:'session1' 56 | }) 57 | .then(async client => await start(client)) 58 | .catch(e=>{ 59 | console.log('Error',e.message); 60 | }); -------------------------------------------------------------------------------- /docs/src/components/OpenReplay/OpenReplay.ts: -------------------------------------------------------------------------------- 1 | import siteConfig from '@generated/docusaurus.config'; 2 | import Tracker from '@openreplay/tracker'; 3 | 4 | const OPENREPLAY_SESSION_COOKIE = 'openReplaySessionHash'; 5 | const OPENREPLAY_INGEST_POINT = siteConfig.customFields.openReplayIngestPoint as string; 6 | const OPENREPLAY_PROJECT_KEY = siteConfig.customFields.openReplayProjectKey as string; 7 | 8 | let tracker: Tracker | null = null; 9 | 10 | export const initOpenReplay = async () => { 11 | const { default: Tracker } = await import('@openreplay/tracker'); 12 | tracker = new Tracker({ 13 | projectKey: OPENREPLAY_PROJECT_KEY, 14 | ingestPoint: OPENREPLAY_INGEST_POINT, 15 | __DISABLE_SECURE_MODE: true, 16 | }); 17 | }; 18 | 19 | export const startOpenReplayTracking = (userId?: string) => { 20 | if (tracker) { 21 | const cookies = document.cookie.split('; '); 22 | const cookie = cookies.find(c => c.startsWith(`${OPENREPLAY_SESSION_COOKIE}=`)); 23 | const existingSessionHash = cookie ? cookie.split('=')[1] : null; 24 | 25 | if (existingSessionHash) { 26 | // Resume existing session 27 | tracker.start({ sessionHash: existingSessionHash }); 28 | } else { 29 | // Start a new session 30 | tracker.start(); 31 | const newSessionHash = tracker.getSessionToken(); 32 | if (newSessionHash) { 33 | document.cookie = `${OPENREPLAY_SESSION_COOKIE}=${newSessionHash};`; 34 | } 35 | } 36 | 37 | // Set the user ID in both cases 38 | tracker.setUserID(userId); 39 | } else { 40 | console.warn('OpenReplay tracker is not initialized'); 41 | } 42 | }; 43 | 44 | export const optOutOpenReplayTracking = () => { 45 | if (tracker) { 46 | tracker.stop(); 47 | } 48 | } -------------------------------------------------------------------------------- /src/api/model/reactions.ts: -------------------------------------------------------------------------------- 1 | import { ContactId } from "./aliases"; 2 | import { Message, MessageAck } from "./message"; 3 | 4 | /** 5 | * A reaction is identified the specific emoji. 6 | */ 7 | export type Reaction = { 8 | /** 9 | * The aggregate emoji used for the reaction. 10 | */ 11 | aggregateEmoji: string; 12 | /** 13 | * The identifier of the reaction 14 | */ 15 | id: string; 16 | /** 17 | * If the reaction is also sent by the host account 18 | */ 19 | hasReactionByMe: boolean; 20 | /** 21 | * The senders of this spefcific reaction 22 | */ 23 | senders: ReactionRecord[]; 24 | } 25 | 26 | /** 27 | * The specific reaction by a user 28 | */ 29 | export type ReactionRecord = { 30 | /** 31 | * The acknowledgement of the reaction 32 | */ 33 | ack: MessageAck; 34 | /** 35 | * The ID of the reaction 36 | */ 37 | id: string; 38 | 39 | msgKey: string; 40 | parentMsgKey: string; 41 | orphan: number; 42 | /** 43 | * The text of the reaction 44 | */ 45 | reactionText: string; 46 | /** 47 | * If the reaction has been read 48 | */ 49 | read: boolean; 50 | /** 51 | * The ID of the reaction sender 52 | */ 53 | senderUserJid: ContactId; 54 | /** 55 | * The timestamp of the reaction 56 | */ 57 | timestamp: number; 58 | } 59 | 60 | /** 61 | * Emitted by onReaction 62 | */ 63 | export type ReactionEvent = { 64 | /** 65 | * The message being reacted to 66 | */ 67 | message: Message; 68 | /** 69 | * The reaction sent by the host account 70 | */ 71 | reactionByMe: Reaction; 72 | /** 73 | * An array of all reactions 74 | */ 75 | reactions: Reaction[]; 76 | /** 77 | * The type of the reaction event. 78 | */ 79 | type: 'add' | 'change'; 80 | } -------------------------------------------------------------------------------- /docs/docs/reference/api/model/errors/enumerations/ERROR_NAME.md: -------------------------------------------------------------------------------- 1 | # Enumeration: ERROR\_NAME 2 | 3 | Enum of error names specific to this library 4 | 5 | ## Enumeration Members 6 | 7 | ### BAD\_STICKER\_METADATA 8 | 9 | > **BAD\_STICKER\_METADATA**: `"BAD_STICKER_METADATA"` 10 | 11 | The sticker metadata parameter is wrong. 12 | 13 | *** 14 | 15 | ### FILE\_NOT\_FOUND 16 | 17 | > **FILE\_NOT\_FOUND**: `"FILE_NOT_FOUND"` 18 | 19 | File was not found at given path. 20 | 21 | *** 22 | 23 | ### INVALID\_LABEL 24 | 25 | > **INVALID\_LABEL**: `"INVALID_LABEL"` 26 | 27 | Label does not exist 28 | 29 | *** 30 | 31 | ### MEDIA\_MISSING 32 | 33 | > **MEDIA\_MISSING**: `"MEDIA_MISSING"` 34 | 35 | Expected media is missing. 36 | 37 | *** 38 | 39 | ### MISSING\_URL 40 | 41 | > **MISSING\_URL**: `"MISSING_URL"` 42 | 43 | An expected URL is missing 44 | 45 | *** 46 | 47 | ### NOT\_MEDIA 48 | 49 | > **NOT\_MEDIA**: `"NOT_MEDIA"` 50 | 51 | The message is not a media message. 52 | 53 | *** 54 | 55 | ### PAGE\_CLOSED 56 | 57 | > **PAGE\_CLOSED**: `"PAGE_CLOSED"` 58 | 59 | The puppeteer page has been closed or the client has lost the connection with the page. This can happen if your computer/server has gone to sleep and waken up. Please restart your session. 60 | 61 | *** 62 | 63 | ### SENDTEXT\_FAILURE 64 | 65 | > **SENDTEXT\_FAILURE**: `"SENDTEXT_FAILURE"` 66 | 67 | Unable to send text 68 | 69 | *** 70 | 71 | ### STATE\_ERROR 72 | 73 | > **STATE\_ERROR**: `"STATE_ERROR"` 74 | 75 | The client state is preventing the command from completing. 76 | 77 | *** 78 | 79 | ### STICKER\_NOT\_DECRYPTED 80 | 81 | > **STICKER\_NOT\_DECRYPTED**: `"STICKER_NOT_DECRYPTED"` 82 | 83 | The attempt to decrypt a sticker message has failed. 84 | 85 | *** 86 | 87 | ### STICKER\_TOO\_LARGE 88 | 89 | > **STICKER\_TOO\_LARGE**: `"STICKER_TOO_LARGE"` 90 | 91 | The sticker file exceeds the maximum 1MB limit 92 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/aliases/type-aliases/CountryCode.md: -------------------------------------------------------------------------------- 1 | # Type Alias: CountryCode 2 | 3 | > **CountryCode**: `1` \| `7` \| `20` \| `27` \| `30` \| `31` \| `32` \| `33` \| `34` \| `36` \| `39` \| `40` \| `41` \| `43` \| `44` \| `45` \| `46` \| `47` \| `48` \| `49` \| `51` \| `52` \| `53` \| `54` \| `55` \| `56` \| `57` \| `58` \| `60` \| `61` \| `62` \| `63` \| `64` \| `65` \| `66` \| `81` \| `82` \| `84` \| `86` \| `90` \| `91` \| `92` \| `93` \| `94` \| `95` \| `98` \| `211` \| `212` \| `213` \| `216` \| `218` \| `220` \| `221` \| `222` \| `223` \| `224` \| `225` \| `226` \| `227` \| `228` \| `229` \| `230` \| `231` \| `232` \| `233` \| `234` \| `235` \| `236` \| `237` \| `238` \| `239` \| `240` \| `241` \| `242` \| `243` \| `244` \| `245` \| `246` \| `248` \| `249` \| `250` \| `251` \| `252` \| `253` \| `254` \| `255` \| `256` \| `257` \| `258` \| `260` \| `261` \| `262` \| `263` \| `264` \| `265` \| `266` \| `267` \| `268` \| `269` \| `290` \| `291` \| `297` \| `298` \| `299` \| `350` \| `351` \| `352` \| `353` \| `354` \| `355` \| `356` \| `357` \| `358` \| `359` \| `370` \| `371` \| `372` \| `373` \| `374` \| `375` \| `376` \| `377` \| `378` \| `380` \| `381` \| `382` \| `383` \| `385` \| `386` \| `387` \| `389` \| `420` \| `421` \| `423` \| `500` \| `501` \| `502` \| `503` \| `504` \| `505` \| `506` \| `507` \| `508` \| `509` \| `590` \| `591` \| `592` \| `593` \| `594` \| `595` \| `596` \| `597` \| `598` \| `599` \| `670` \| `672` \| `673` \| `674` \| `675` \| `676` \| `677` \| `678` \| `679` \| `680` \| `681` \| `682` \| `683` \| `685` \| `686` \| `687` \| `688` \| `689` \| `690` \| `691` \| `692` \| `850` \| `852` \| `853` \| `855` \| `856` \| `880` \| `886` \| `960` \| `961` \| `962` \| `963` \| `964` \| `965` \| `966` \| `967` \| `968` \| `970` \| `971` \| `972` \| `973` \| `974` \| `975` \| `976` \| `977` \| `992` \| `993` \| `994` \| `995` \| `996` \| `998` 4 | 5 | Type alias representing all available country codes 6 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/sessionInfo/interfaces/HealthCheck.md: -------------------------------------------------------------------------------- 1 | # Interface: HealthCheck 2 | 3 | ## Properties 4 | 5 | ### batteryLow? 6 | 7 | > `optional` **batteryLow**: `boolean` 8 | 9 | Returns `true` if "Phone battery low" message is detected 10 | 11 | Healthy: `false` 12 | 13 | *** 14 | 15 | ### isHere? 16 | 17 | > `optional` **isHere**: `boolean` 18 | 19 | Returns `true` if "Use Here" button is not detected 20 | 21 | Healthy: `true` 22 | 23 | *** 24 | 25 | ### isPhoneDisconnected? 26 | 27 | > `optional` **isPhoneDisconnected**: `boolean` 28 | 29 | Whether or not the "Phone is disconnected" message is showing within the web app. 30 | 31 | Healthy: `false` 32 | 33 | *** 34 | 35 | ### online? 36 | 37 | > `optional` **online**: `boolean` 38 | 39 | Result of `window.navigator.onLine` 40 | 41 | Healthy: `true` 42 | 43 | *** 44 | 45 | ### queuedMessages? 46 | 47 | > `optional` **queuedMessages**: `number` 48 | 49 | The number of messages queued up in the browser. Messages can start being queued up due to the web app awaiting a connection with the host device. 50 | 51 | Healthy: 0 52 | 53 | *** 54 | 55 | ### retryingIn? 56 | 57 | > `optional` **retryingIn**: `number` 58 | 59 | Returns the number of seconds the "Retrying in ..." dialog is indicating. If the dialog is not showing, it will return `0`. 60 | 61 | Healthy: `0` 62 | 63 | *** 64 | 65 | ### state? 66 | 67 | > `optional` **state**: [`STATE`](/reference/api/model/enumerations/STATE.md) 68 | 69 | The state of the web app. 70 | 71 | Healthy: 'CONNECTED' 72 | 73 | *** 74 | 75 | ### tryingToReachPhone? 76 | 77 | > `optional` **tryingToReachPhone**: `boolean` 78 | 79 | Returns `true` if "trying to reach phone" dialog is detected 80 | 81 | Healthy: `false` 82 | 83 | *** 84 | 85 | ### wapiInjected? 86 | 87 | > `optional` **wapiInjected**: `boolean` 88 | 89 | Returns `true` if the `WAPI` object is detected. 90 | 91 | Healthy: `true` 92 | -------------------------------------------------------------------------------- /docs/docs/get-started/installation.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Custom Code 3 | sidebar_position: 2 4 | --- 5 | 6 | # Installation 7 | 8 | ## Standard Installation 9 | 10 | Run the following command to ensure you have wa-automate installed: 11 | 12 | ```bash 13 | > npm install @open-wa/wa-automate 14 | ``` 15 | 16 | or using yarn: 17 | 18 | ```bash 19 | > yarn add @open-wa/wa-automate 20 | ``` 21 | 22 | You can then add the library to your project: 23 | 24 | ```javascript 25 | import { create, Client, decryptMedia, ev } from '@open-wa/wa-automate'; 26 | 27 | ``` 28 | 29 | ## CentOS Installation 30 | 31 | Some people report CentOS causing problems when installing this library. 32 | 33 | Try the following: 34 | 35 | ```bash 36 | > npm install @open-wa/wa-automate --unsafe-perm 37 | ``` 38 | 39 | or if you come accros permission issues: 40 | 41 | ```bash 42 | > sudo npm install @open-wa/wa-automate --unsafe-perm 43 | ``` 44 | 45 | ## Installation when primarily using Chrome 46 | 47 | If you use chrome, by setting [`useChrome`](/docs/api/interfaces/api.ConfigObject#useChrome) or [`executablePath`](/docs/api/interfaces/api.ConfigObject#executablepath) then you don't need to install the whole of puppeteer (puppeteer installs a version of Chromium - not Chrome - by default). 48 | 49 | If there are issues with installing the packages then try this: 50 | 51 | ```bash 52 | > npm install @open-wa/wa-automate --ignore-scripts 53 | ``` 54 | 55 | Doing this saves time and memory. 56 | 57 | ## Chrome issues on Linux based systems 58 | 59 | Some people report issues with running the program using the built in puppeteer chromium package. Use this to install dependencies and install chrome. After doing the following command you can use Chrome by setting `useChrome: true` in the config or with the `--use-chrome` flag with the CLI. 60 | 61 | ```bash 62 | > wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 63 | > sudo apt install ./google-chrome-stable_current_amd64.deb 64 | ``` 65 | -------------------------------------------------------------------------------- /docs/docs/reference/index.md: -------------------------------------------------------------------------------- 1 | # @open-wa/wa-automate v4.76.0 2 | 3 | ## Modules 4 | 5 | - [api/Client](/reference/api/Client/index.md) 6 | - [api/functions/exposed.enum](/reference/api/functions/exposed.enum/index.md) 7 | - [api/model](/reference/api/model/index.md) 8 | - [api/model/aliases](/reference/api/model/aliases/index.md) 9 | - [api/model/button](/reference/api/model/button/index.md) 10 | - [api/model/call](/reference/api/model/call/index.md) 11 | - [api/model/chat](/reference/api/model/chat/index.md) 12 | - [api/model/config](/reference/api/model/config/index.md) 13 | - [api/model/contact](/reference/api/model/contact/index.md) 14 | - [api/model/errors](/reference/api/model/errors/index.md) 15 | - [api/model/events](/reference/api/model/events/index.md) 16 | - [api/model/group-metadata](/reference/api/model/group-metadata/index.md) 17 | - [api/model/id](/reference/api/model/id/index.md) 18 | - [api/model/label](/reference/api/model/label/index.md) 19 | - [api/model/media](/reference/api/model/media/index.md) 20 | - [api/model/message](/reference/api/model/message/index.md) 21 | - [api/model/product](/reference/api/model/product/index.md) 22 | - [api/model/reactions](/reference/api/model/reactions/index.md) 23 | - [api/model/sessionInfo](/reference/api/model/sessionInfo/index.md) 24 | - [controllers/events](/reference/controllers/events/index.md) 25 | - [controllers/init\_patch](/reference/controllers/init_patch/index.md) 26 | - [controllers/initializer](/reference/controllers/initializer/index.md) 27 | - [controllers/patch\_manager](/reference/controllers/patch_manager/index.md) 28 | - [logging/custom\_transport](/reference/logging/custom_transport/index.md) 29 | - [logging/logging](/reference/logging/logging/index.md) 30 | - [structures/Collector](/reference/structures/Collector/index.md) 31 | - [structures/Dialog](/reference/structures/Dialog/index.md) 32 | - [structures/MessageCollector](/reference/structures/MessageCollector/index.md) 33 | - [structures/preProcessors](/reference/structures/preProcessors/index.md) 34 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | ignore: 9 | - dependency-name: "@types/node" 10 | versions: 11 | - 14.14.30 12 | - 14.14.31 13 | - 15.0.0 14 | - dependency-name: open 15 | versions: 16 | - 8.0.1 17 | - 8.0.5 18 | - 8.0.6 19 | - dependency-name: puppeteer 20 | versions: 21 | - 7.0.1 22 | - 7.1.0 23 | - 9.0.0 24 | - dependency-name: typedoc 25 | versions: 26 | - 0.20.20 27 | - 0.20.23 28 | - 0.20.24 29 | - 0.20.25 30 | - 0.20.27 31 | - 0.20.28 32 | - 0.20.29 33 | - 0.20.30 34 | - dependency-name: "@typescript-eslint/eslint-plugin" 35 | versions: 36 | - 4.16.1 37 | - dependency-name: patch-package 38 | versions: 39 | - 6.4.0 40 | - dependency-name: husky 41 | versions: 42 | - 5.0.9 43 | - 5.1.0 44 | - 5.1.1 45 | - 5.1.2 46 | - dependency-name: ts-morph 47 | versions: 48 | - 10.0.0 49 | - 10.0.1 50 | - dependency-name: rxjs 51 | versions: 52 | - 6.6.6 53 | - dependency-name: swagger-ui-dist 54 | versions: 55 | - 3.44.0 56 | - dependency-name: typescript 57 | versions: 58 | - 4.2.0-dev.20210201 59 | - 4.2.0-dev.20210203 60 | - 4.2.0-dev.20210204 61 | - 4.2.0-dev.20210205 62 | - 4.2.0-dev.20210208 63 | - 4.2.0-insiders.20210210 64 | - 4.2.2 65 | - dependency-name: release-it 66 | versions: 67 | - 14.4.1 68 | - dependency-name: "@grupoboticario/news-fragments" 69 | versions: 70 | - 1.9.1 71 | - dependency-name: puppeteer-extra-plugin-devtools 72 | versions: 73 | - 2.2.16 74 | - dependency-name: terminal-link 75 | versions: 76 | - 3.0.0 77 | - dependency-name: "@typescript-eslint/parser" 78 | versions: 79 | - 4.21.0 80 | - dependency-name: socket.io 81 | versions: 82 | - 4.0.0 83 | - 4.0.1 84 | - dependency-name: p-queue 85 | versions: 86 | - 7.0.0 87 | -------------------------------------------------------------------------------- /docs/src/ui/button.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { Slot } from "@radix-ui/react-slot" 3 | import { cva, type VariantProps } from "class-variance-authority" 4 | 5 | import { cn } from "../lib/utils" 6 | 7 | const buttonVariants = cva( 8 | "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", 9 | { 10 | variants: { 11 | variant: { 12 | default: "bg-primary text-primary-foreground hover:bg-primary/90", 13 | destructive: 14 | "bg-destructive text-destructive-foreground hover:bg-destructive/90", 15 | outline: 16 | "border border-input bg-background hover:bg-accent hover:text-accent-foreground", 17 | secondary: 18 | "bg-secondary text-secondary-foreground hover:bg-secondary/80", 19 | ghost: "hover:bg-accent hover:text-accent-foreground", 20 | link: "text-primary underline-offset-4 hover:underline", 21 | }, 22 | size: { 23 | default: "h-10 px-4 py-2", 24 | sm: "h-9 rounded-md px-3", 25 | lg: "h-11 rounded-md px-8", 26 | icon: "h-10 w-10", 27 | }, 28 | }, 29 | defaultVariants: { 30 | variant: "default", 31 | size: "default", 32 | }, 33 | } 34 | ) 35 | 36 | export interface ButtonProps 37 | extends React.ButtonHTMLAttributes, 38 | VariantProps { 39 | asChild?: boolean 40 | } 41 | 42 | const Button = React.forwardRef( 43 | ({ className, variant, size, asChild = false, ...props }, ref) => { 44 | const Comp = asChild ? Slot : "button" 45 | return ( 46 | 51 | ) 52 | } 53 | ) 54 | Button.displayName = "Button" 55 | 56 | export { Button, buttonVariants } 57 | -------------------------------------------------------------------------------- /docs/docs/configuration/the-client.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_label: The Client 3 | description: 4 | Guide showing how to edit the settings. 5 | sidebar_position: 1 6 | --- 7 | 8 | # The Client 9 | 10 | Who/what is the client? The Client is the orchestrator of a WA Web session. You can have multiple clients in one node (or ts-node) process. But it's generally best practice to keep a single client on a single process. 11 | 12 | ## How to create a client 13 | 14 | After you've installed the library in your project, you can then use [create] to ***create*** a new session. This simple example starts a bot that replies with `👋 Hello!` when it receives a `Hi` 15 | 16 | ```javascript 17 | const { create, Client } = require('@open-wa/wa-automate'); 18 | 19 | // or 20 | // import { create, Client } from '@open-wa/wa-automate'; 21 | 22 | 23 | function start(client) { 24 | client.onMessage(async message => { 25 | if (message.body === 'Hi') { 26 | await client.sendText(message.from, '👋 Hello!'); 27 | } 28 | }); 29 | } 30 | 31 | create().then(start); 32 | 33 | ``` 34 | 35 | The method `create` is what creates, authenticates/reloads a session. When you call create, make sure to keep an eye on the console output. In the console it will log the loading state of the client and the QR code (if there is no valid session data). 36 | 37 | You can call `create()` on it's own, however there are a bunch of powerful configuration variables you can set to acheive a more custom set up. 38 | 39 | [[ConfigObject]] 40 | 41 | Please note that you will be unable to scan the QR code if it is on a dark background. 42 | 43 | ## What happens when the session starts 44 | 45 | In order to eliminate potential phishing attacks using this library, a message is sent to the host account from itself notifying the account user that the account is being managed/controlled using an automation software. 46 | 47 | This host notification will result in a CORS error in the browser instance. You can ignore the error. 48 | 49 | Learn more here: https://github.com/open-wa/wa-automate-nodejs/issues/709#issuecomment-673419088 50 | -------------------------------------------------------------------------------- /bin/server.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | const pm2Index = process.argv.findIndex(arg => arg === "--pm2"); 3 | const sIdIndex = process.argv.findIndex(arg => arg === "--session-id"); 4 | const nameIndex = process.argv.findIndex(arg => arg === "--name"); 5 | const getVal = (index) => index !== -1 && process.argv[index + 1] 6 | const getBool = (index) => !((index !== -1 && process.argv[index + 1]) === false) 7 | const procName = getVal(sIdIndex || nameIndex) || "@OPEN-WA EASY API"; 8 | const CLI = '../dist/cli' 9 | async function start() { 10 | if (getBool(pm2Index)) { 11 | const { spawn } = require("child_process"); 12 | try { 13 | const pm2 = spawn('pm2'); 14 | await new Promise((resolve, reject) => { 15 | pm2.on('error', reject); 16 | pm2.stdout.on('data', () => resolve(true)); 17 | }) 18 | const stringedArgs = (getVal(pm2Index) || "").match(/"[^"]*"/g); 19 | let pm2ArgString = (getVal(pm2Index) || ""); 20 | if(stringedArgs) stringedArgs.map(stringedArg => pm2ArgString = pm2ArgString.replace(stringedArg, stringedArg.replaceAll(" ","|~|"))) 21 | const pm2Flags = pm2ArgString.split(" ").map(r=>r.replaceAll("|~|"," ")).flatMap(r=>r.split("=")).map(r=>r.replaceAll('"',"")).filter(x=>x); 22 | const cliFlags = (process.argv.slice(2) || []); 23 | spawn("pm2", [ 24 | "start", 25 | require.resolve(CLI), 26 | '--name', 27 | procName, 28 | '--stop-exit-codes', 29 | '88', 30 | ...pm2Flags, 31 | '--', 32 | ...cliFlags.filter(x=>!pm2Flags.includes(x)) 33 | ], { 34 | stdio: "inherit", 35 | detached: true 36 | }) 37 | } catch (error) { 38 | if (error.errorno === -2) console.error("pm2 not found. Please install with the following command: npm install -g pm2"); 39 | } 40 | } else { 41 | require(CLI); 42 | } 43 | } 44 | 45 | start() -------------------------------------------------------------------------------- /docs/docs/reference/structures/Collector/interfaces/AwaitMessagesOptions.md: -------------------------------------------------------------------------------- 1 | # Interface: AwaitMessagesOptions 2 | 3 | Options to be applied to the collector. 4 | 5 | ## Extends 6 | 7 | - [`CollectorOptions`](/reference/structures/Collector/interfaces/CollectorOptions.md) 8 | 9 | ## Properties 10 | 11 | ### dispose? 12 | 13 | > `optional` **dispose**: `boolean` 14 | 15 | Whether to dispose data when it's deleted 16 | 17 | #### Inherited from 18 | 19 | [`CollectorOptions`](/reference/structures/Collector/interfaces/CollectorOptions.md).[`dispose`](/reference/structures/Collector/interfaces/CollectorOptions.md#dispose) 20 | 21 | *** 22 | 23 | ### errors? 24 | 25 | > `optional` **errors**: `string`[] 26 | 27 | An array of "reasons" that would result in the awaitMessages command to throw an error. 28 | 29 | *** 30 | 31 | ### idle? 32 | 33 | > `optional` **idle**: `number` 34 | 35 | Max time allowed idle 36 | 37 | #### Inherited from 38 | 39 | [`CollectorOptions`](/reference/structures/Collector/interfaces/CollectorOptions.md).[`idle`](/reference/structures/Collector/interfaces/CollectorOptions.md#idle) 40 | 41 | *** 42 | 43 | ### max? 44 | 45 | > `optional` **max**: `number` 46 | 47 | The maximum amount of items to collect 48 | 49 | #### Inherited from 50 | 51 | [`CollectorOptions`](/reference/structures/Collector/interfaces/CollectorOptions.md).[`max`](/reference/structures/Collector/interfaces/CollectorOptions.md#max) 52 | 53 | *** 54 | 55 | ### maxProcessed? 56 | 57 | > `optional` **maxProcessed**: `number` 58 | 59 | The maximum amount of items to process 60 | 61 | #### Inherited from 62 | 63 | [`CollectorOptions`](/reference/structures/Collector/interfaces/CollectorOptions.md).[`maxProcessed`](/reference/structures/Collector/interfaces/CollectorOptions.md#maxprocessed) 64 | 65 | *** 66 | 67 | ### time? 68 | 69 | > `optional` **time**: `number` 70 | 71 | Max time to wait for items in milliseconds 72 | 73 | #### Inherited from 74 | 75 | [`CollectorOptions`](/reference/structures/Collector/interfaces/CollectorOptions.md).[`time`](/reference/structures/Collector/interfaces/CollectorOptions.md#time) 76 | -------------------------------------------------------------------------------- /docs/src/config/consts.ts: -------------------------------------------------------------------------------- 1 | import { optionList } from "../../../dist/cli/cli-options" 2 | 3 | export const consts = { 4 | githubOrgUrl: "https://github.com/open-wa", 5 | domain: "docs.openwa.dev", 6 | } 7 | 8 | const cliOptionsToMDTable = () => { 9 | let table = ` 10 | | Option | Type | Description | 11 | |-------|------|-------| 12 | ` 13 | optionList.map((option) => { 14 | table += `| --${option.name} | ${option.type?.prototype.constructor.name.toLowerCase() || ""} | ${option.description}${Object.keys(option).includes("default") ? ` (default: ${option.default})` : ""} |\n ` 15 | }) 16 | return table; 17 | } 18 | 19 | export const customFields = { 20 | artifactHubUrl: "", 21 | copyright: `Copyright © ${new Date().getFullYear()} open-wa`, 22 | crunchbaseUrl: "", 23 | demoUrl: `https://demo.${consts.domain}`, 24 | description: 25 | "Open-wa is an open source project designed to make building WA-based chatbots lightning fast and easy. It exposes a high performance REST API and is highly-customizable.", 26 | dockerUrl: "https://hub.docker.com/r/openwa/wa-automate", 27 | domain: consts.domain, 28 | githubOrgUrl: consts.githubOrgUrl, 29 | discordInviteUrl: "https://discord.gg/dpan7EYE3t", 30 | githubUrl: `${consts.githubOrgUrl}/wa-automate-nodejs`, 31 | linkedInUrl: "", 32 | oneLiner: "QuestDB: the database for time series", 33 | slackUrl: `https://slack.${consts.domain}`, 34 | stackoverflowUrl: "https://stackoverflow.com/questions/tagged/open-wa", 35 | twitterUrl: "https://twitter.com/openwadev", 36 | videosUrl: "", 37 | cliOptionsTable: cliOptionsToMDTable(), 38 | openReplayIngestPoint: 'https://openreplay.synthetiko.com/ingest', 39 | openReplayProjectKey: 'H2nrOVVUP38T7Lr1tqZg', 40 | labels: { 41 | // "license:insiders": `:::note May require Insiders license\nUse this link to get the [correct license](../../backend/users.m).\n:::` 42 | "license:insiders": `Insiders` 43 | // "license:insiders": `::youtube[Video of a cat in a box]{#01ab2cd3efg}` 44 | } 45 | } -------------------------------------------------------------------------------- /src/api/model/sessionInfo.ts: -------------------------------------------------------------------------------- 1 | import { STATE } from '.'; 2 | 3 | export interface SessionInfo { 4 | WA_VERSION: string; 5 | PAGE_UA: string; 6 | WA_AUTOMATE_VERSION: string; 7 | BROWSER_VERSION: string; 8 | LAUNCH_TIME_MS?: number; 9 | NUM?: string; 10 | OS?: string; 11 | START_TS?: number; 12 | PHONE_VERSION?: string; 13 | NUM_HASH?: string; 14 | PATCH_HASH?: string; 15 | OW_KEY?: string; 16 | INSTANCE_ID?: string; 17 | RAM_INFO?: string; 18 | PPTR_VERSION?: string; 19 | LATEST_VERSION ?: boolean; 20 | CLI ?: boolean; 21 | ACC_TYPE ?: 'PERSONAL' | 'BUSINESS'; 22 | } 23 | 24 | export interface HealthCheck { 25 | /** 26 | * The number of messages queued up in the browser. Messages can start being queued up due to the web app awaiting a connection with the host device. 27 | * 28 | * Healthy: 0 29 | */ 30 | queuedMessages?: number; 31 | /** 32 | * The state of the web app. 33 | * 34 | * Healthy: 'CONNECTED' 35 | */ 36 | state?: STATE; 37 | /** 38 | * Whether or not the "Phone is disconnected" message is showing within the web app. 39 | * 40 | * Healthy: `false` 41 | */ 42 | isPhoneDisconnected?: boolean; 43 | /** 44 | * Returns `true` if "Use Here" button is not detected 45 | * 46 | * Healthy: `true` 47 | */ 48 | isHere?: boolean; 49 | /** 50 | * Returns `true` if the `WAPI` object is detected. 51 | * 52 | * Healthy: `true` 53 | */ 54 | wapiInjected?: boolean; 55 | /** 56 | * Result of `window.navigator.onLine` 57 | * 58 | * Healthy: `true` 59 | */ 60 | online?: boolean; 61 | /** 62 | * Returns `true` if "trying to reach phone" dialog is detected 63 | * 64 | * Healthy: `false` 65 | */ 66 | tryingToReachPhone?: boolean; 67 | /** 68 | * Returns the number of seconds the "Retrying in ..." dialog is indicating. If the dialog is not showing, it will return `0`. 69 | * 70 | * Healthy: `0` 71 | */ 72 | retryingIn?: number; 73 | /** 74 | * Returns `true` if "Phone battery low" message is detected 75 | * 76 | * Healthy: `false` 77 | */ 78 | batteryLow ?: boolean; 79 | } 80 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/errors/classes/SessionExpiredError.md: -------------------------------------------------------------------------------- 1 | # Class: SessionExpiredError 2 | 3 | ## Extends 4 | 5 | - `Error` 6 | 7 | ## Constructors 8 | 9 | ### new SessionExpiredError() 10 | 11 | > **new SessionExpiredError**(): [`SessionExpiredError`](/reference/api/model/errors/classes/SessionExpiredError.md) 12 | 13 | #### Returns 14 | 15 | [`SessionExpiredError`](/reference/api/model/errors/classes/SessionExpiredError.md) 16 | 17 | #### Overrides 18 | 19 | `Error.constructor` 20 | 21 | ## Properties 22 | 23 | ### cause? 24 | 25 | > `optional` **cause**: `unknown` 26 | 27 | #### Inherited from 28 | 29 | `Error.cause` 30 | 31 | *** 32 | 33 | ### message 34 | 35 | > **message**: `string` 36 | 37 | #### Inherited from 38 | 39 | `Error.message` 40 | 41 | *** 42 | 43 | ### name 44 | 45 | > **name**: `string` 46 | 47 | #### Inherited from 48 | 49 | `Error.name` 50 | 51 | *** 52 | 53 | ### stack? 54 | 55 | > `optional` **stack**: `string` 56 | 57 | #### Inherited from 58 | 59 | `Error.stack` 60 | 61 | *** 62 | 63 | ### prepareStackTrace()? 64 | 65 | > `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` 66 | 67 | Optional override for formatting stack traces 68 | 69 | #### Parameters 70 | 71 | • **err**: `Error` 72 | 73 | • **stackTraces**: `CallSite`[] 74 | 75 | #### Returns 76 | 77 | `any` 78 | 79 | #### See 80 | 81 | https://v8.dev/docs/stack-trace-api#customizing-stack-traces 82 | 83 | #### Inherited from 84 | 85 | `Error.prepareStackTrace` 86 | 87 | *** 88 | 89 | ### stackTraceLimit 90 | 91 | > `static` **stackTraceLimit**: `number` 92 | 93 | #### Inherited from 94 | 95 | `Error.stackTraceLimit` 96 | 97 | ## Methods 98 | 99 | ### captureStackTrace() 100 | 101 | > `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` 102 | 103 | Create .stack property on a target object 104 | 105 | #### Parameters 106 | 107 | • **targetObject**: `object` 108 | 109 | • **constructorOpt?**: `Function` 110 | 111 | #### Returns 112 | 113 | `void` 114 | 115 | #### Inherited from 116 | 117 | `Error.captureStackTrace` 118 | -------------------------------------------------------------------------------- /docs/docs/how-to/location.md: -------------------------------------------------------------------------------- 1 | # Location 2 | 3 | ## Sending Location 4 | 5 | [[sendLocation]] 6 | 7 | ```javascript 8 | client.sendLocation(chatId, latitude, longitude, 'London!') 9 | ``` 10 | 11 | ## Receiving Location 12 | 13 | Check the [[Message]] reference to learn how to extract the coordinates from a location message 14 | 15 | ```javascript 16 | client.onMessage(message=> { 17 | if(message.type==="location") { 18 | //Using destructuring 19 | const { 20 | // The text associated with the location 21 | loc, 22 | //Latitude 23 | lat, 24 | //Longitude 25 | lng 26 | } = message 27 | } 28 | }) 29 | ``` 30 | 31 | ## Listening to Live Locations 32 | 33 | [[onLiveLocation]] fires a [[LiveLocationChangedEvent]] event. [[onLiveLocation]] requires a chat id to listen to so you need to detect exactly when a chat starts sharing a live location with your host account. This example detects when a live location is started and then registers a new callback to listen to updates in that live location session. 34 | 35 | ```javascript 36 | const liveLocationCallback = currentLiveLocation => { 37 | console.log('Live location update', currentLiveLocation.id, currentLiveLocation.lat, currentLiveLocation.lng); 38 | } 39 | client.onMessage(message=> { 40 | //This is how to detect when someone has started a live location with you 41 | if(message.shareDuration){ 42 | client.onLiveLocation(message.from, liveLocationCallback) 43 | } 44 | }) 45 | 46 | ``` 47 | 48 | ### Forcing Live Locations to Update 49 | 50 | The updates of live locations are very passive. If you require updates at regular intervals then you can force it using [[forceUpdateLiveLocation]]. It is recomended to keep an array of chat ids that have live location sessions and map through them at regular intervals 51 | 52 | ```javascript 53 | await client.forceUpdateLiveLocation(chatId); 54 | 55 | //or force update live locations of multiple chats 56 | await Promise.all([ 57 | 'chatId1', 58 | 'chatId2' 59 | ].map(client.forceUpdateLiveLocation)); 60 | ``` 61 | -------------------------------------------------------------------------------- /demo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12-slim 2 | 3 | RUN apt-get update && \ 4 | apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \ 5 | libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \ 6 | libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \ 7 | libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \ 8 | fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \ 9 | ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget && \ 10 | wget https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64.deb && \ 11 | dpkg -i dumb-init_*.deb && rm -f dumb-init_*.deb && \ 12 | apt-get clean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* 13 | 14 | RUN yarn global add puppeteer @open-wa/wa-automate ts-node && yarn cache clean 15 | 16 | ENV NODE_PATH="/usr/local/share/.config/yarn/global/node_modules:${NODE_PATH}" 17 | 18 | ENV PATH="/tools:${PATH}" 19 | 20 | RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser 21 | 22 | COPY --chown=pptruser:pptruser ./tools /tools 23 | 24 | # Set language to UTF8 25 | ENV LANG="C.UTF-8" 26 | 27 | WORKDIR /app 28 | 29 | #COPY ./package.json /app 30 | 31 | # Add user so we don't need --no-sandbox. 32 | RUN mkdir /screenshots \ 33 | && mkdir -p /home/pptruser/Downloads \ 34 | && chown -R pptruser:pptruser /home/pptruser \ 35 | && chown -R pptruser:pptruser /usr/local/share/.config/yarn/global/node_modules \ 36 | && chown -R pptruser:pptruser /screenshots \ 37 | && chown -R pptruser:pptruser /app \ 38 | && chown -R pptruser:pptruser /tools 39 | 40 | # Run everything after as non-privileged user. 41 | USER pptruser 42 | 43 | # --cap-add=SYS_ADMIN 44 | # https://docs.docker.com/engine/reference/run/#additional-groups 45 | 46 | ENTRYPOINT ["dumb-init", "--"] 47 | 48 | RUN yarn install 49 | 50 | # CMD ["/usr/local/share/.config/yarn/global/node_modules/puppeteer/.local-chromium/linux-526987/chrome-linux/chrome"] 51 | 52 | # If you are running the demo/index.ts, please make sure to comment out line 1 and uncomment line 2 53 | 54 | CMD ["ts-node", "index.ts"] -------------------------------------------------------------------------------- /docs/src/theme/DocRoot/Layout/index.tsx: -------------------------------------------------------------------------------- 1 | import React, {type ReactNode, useEffect, useState} from 'react'; 2 | import {useDocsSidebar} from '@docusaurus/plugin-content-docs/client'; 3 | import BackToTopButton from '@theme/BackToTopButton'; 4 | import DocRootLayoutSidebar from '@theme/DocRoot/Layout/Sidebar'; 5 | import DocRootLayoutMain from '@theme/DocRoot/Layout/Main'; 6 | import type {Props} from '@theme/DocRoot/Layout'; 7 | import { initOpenReplay, startOpenReplayTracking } from '@site/src/components/OpenReplay/OpenReplay'; 8 | 9 | import styles from './styles.module.css'; 10 | import useIsBrowser from '@docusaurus/useIsBrowser'; 11 | 12 | export default function DocRootLayout({children}: Props): ReactNode { 13 | const sidebar = useDocsSidebar(); 14 | const [hasInitializedOpenReplay, setHasInitializedOpenReplay] = useState(false); 15 | const isBrowser = useIsBrowser(); 16 | const [hasInitialized, setHasInitialized] = useState(false); 17 | const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false); 18 | 19 | 20 | useEffect(() => { 21 | if (isBrowser && !hasInitialized) { 22 | (async () => { 23 | try { 24 | await initOpenReplay(); 25 | setHasInitializedOpenReplay(true); 26 | } catch (error) { 27 | console.error('Failed to initialize OpenReplay:', error); 28 | } 29 | })(); 30 | 31 | setHasInitialized(true); 32 | } 33 | }, [isBrowser, hasInitialized]); 34 | 35 | useEffect(() => { 36 | if (isBrowser && hasInitializedOpenReplay && window.location.hostname !== 'localhost') { 37 | startOpenReplayTracking(); 38 | } 39 | }, [hasInitializedOpenReplay]); 40 | 41 | 42 | return ( 43 |
44 | 45 |
46 | {sidebar && ( 47 | 52 | )} 53 | 54 | {children} 55 | 56 |
57 |
58 | ); 59 | } 60 | -------------------------------------------------------------------------------- /docs/docs/reference/api/model/errors/classes/PageEvaluationTimeout.md: -------------------------------------------------------------------------------- 1 | # Class: PageEvaluationTimeout 2 | 3 | ## Extends 4 | 5 | - `Error` 6 | 7 | ## Constructors 8 | 9 | ### new PageEvaluationTimeout() 10 | 11 | > **new PageEvaluationTimeout**(...`args`): [`PageEvaluationTimeout`](/reference/api/model/errors/classes/PageEvaluationTimeout.md) 12 | 13 | #### Parameters 14 | 15 | • ...**args**: `any`[] 16 | 17 | #### Returns 18 | 19 | [`PageEvaluationTimeout`](/reference/api/model/errors/classes/PageEvaluationTimeout.md) 20 | 21 | #### Overrides 22 | 23 | `Error.constructor` 24 | 25 | ## Properties 26 | 27 | ### cause? 28 | 29 | > `optional` **cause**: `unknown` 30 | 31 | #### Inherited from 32 | 33 | `Error.cause` 34 | 35 | *** 36 | 37 | ### message 38 | 39 | > **message**: `string` 40 | 41 | #### Inherited from 42 | 43 | `Error.message` 44 | 45 | *** 46 | 47 | ### name 48 | 49 | > **name**: `string` 50 | 51 | #### Inherited from 52 | 53 | `Error.name` 54 | 55 | *** 56 | 57 | ### stack? 58 | 59 | > `optional` **stack**: `string` 60 | 61 | #### Inherited from 62 | 63 | `Error.stack` 64 | 65 | *** 66 | 67 | ### prepareStackTrace()? 68 | 69 | > `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` 70 | 71 | Optional override for formatting stack traces 72 | 73 | #### Parameters 74 | 75 | • **err**: `Error` 76 | 77 | • **stackTraces**: `CallSite`[] 78 | 79 | #### Returns 80 | 81 | `any` 82 | 83 | #### See 84 | 85 | https://v8.dev/docs/stack-trace-api#customizing-stack-traces 86 | 87 | #### Inherited from 88 | 89 | `Error.prepareStackTrace` 90 | 91 | *** 92 | 93 | ### stackTraceLimit 94 | 95 | > `static` **stackTraceLimit**: `number` 96 | 97 | #### Inherited from 98 | 99 | `Error.stackTraceLimit` 100 | 101 | ## Methods 102 | 103 | ### captureStackTrace() 104 | 105 | > `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` 106 | 107 | Create .stack property on a target object 108 | 109 | #### Parameters 110 | 111 | • **targetObject**: `object` 112 | 113 | • **constructorOpt?**: `Function` 114 | 115 | #### Returns 116 | 117 | `void` 118 | 119 | #### Inherited from 120 | 121 | `Error.captureStackTrace` 122 | -------------------------------------------------------------------------------- /src/structures/Dialog.ts: -------------------------------------------------------------------------------- 1 | import { ChatId, Client, Message } from ".."; 2 | 3 | export interface CurrentDialogProps { 4 | [k : string] : any 5 | } 6 | 7 | export interface DialogState { 8 | currentStep: number; 9 | currentProps: any; 10 | lastInput: any; 11 | isComplete: boolean; 12 | isError: boolean; 13 | errorMessage: string; 14 | } 15 | 16 | export interface DialogTemplate { 17 | "dialogId": string, 18 | "privateOnly": boolean, 19 | "identifier": string, 20 | "successMessage": string, 21 | "startMessage": string, 22 | "properties": { 23 | [key: string]: DialogProperty 24 | } 25 | } 26 | 27 | export type CheckFunction = (lastReceivedMessage: Message, currentProps: CurrentDialogProps) => boolean 28 | 29 | export interface DialogProperty { 30 | "order": number, 31 | "key": string, 32 | "prompt": string, 33 | "type": string, 34 | "skipCondition" ?: CheckFunction, 35 | "options" ?: DialogButtons[] | DialogListMessageSection[], 36 | "validation": DialogValidation[] 37 | } 38 | 39 | export interface DialogButtons { 40 | label: string, 41 | value: string, 42 | } 43 | 44 | export interface DialogListMessageSection { 45 | title: string, 46 | rows: DialogListMessageRow[] 47 | } 48 | 49 | export interface DialogListMessageRow { 50 | title: string, 51 | description: string, 52 | value: string 53 | } 54 | 55 | export interface DialogValidation { 56 | "type": ValidationType, 57 | "value": string | CheckFunction, 58 | "errorMessage": string 59 | } 60 | 61 | export enum ValidationType { 62 | REGEX = "regex", 63 | LENGTH = "length", 64 | CHECK = "check" 65 | } 66 | 67 | // async function processDialog(dialog: DialogTemplate, chatId: ChatId, client: Client){ 68 | // if(dialog.privateOnly && chatId.includes('g')) return; 69 | // const requiredProperties = Object.keys(dialog.properties); 70 | // const requiredPropertiesInOrder = requiredProperties.map(prop=>dialog.properties[prop]).sort((a, b) => a.order - b.order); 71 | // /** 72 | // * Send start dialog message 73 | // */ 74 | // await client.sendText(chatId, dialog.startMessage); 75 | // requiredPropertiesInOrder.map((diaProp: DialogProperty) => { 76 | // diaProp.type 77 | // }) 78 | // } -------------------------------------------------------------------------------- /docs/docs/how-to/groups.md: -------------------------------------------------------------------------------- 1 | # Group 2 | 3 | ## Create a Group 4 | 5 | Use [[createGroup]] to create a new group, first parameter is the group name, the second parameter is the contact ids to add as participants. There needs to be at least one participant. 6 | 7 | ```javascript 8 | ... 9 | client.createGroup('Cool new group','xxxxxxxxx@c.us') //you can also send an array of ids. 10 | ... 11 | ``` 12 | 13 | ## Managing Participants 14 | 15 | [[addParticipant]] - add a participant 16 | [[removeParticipant]] - remove a particpant 17 | [[promoteParticipant]] - Make a participant admin 18 | [[demoteParticipant]] - remove participant as admin 19 | 20 | ```javascript 21 | ... 22 | client.addParticipant('XXXXXXX-YYYYYY@c.us','ZZZZZZZZZ@c.us') 23 | client.removeParticipant('XXXXXXX-YYYYYY@c.us','ZZZZZZZZZ@c.us') 24 | client.promoteParticipant('XXXXXXX-YYYYYY@c.us','ZZZZZZZZZ@c.us') 25 | client.demoteParticipant('XXXXXXX-YYYYYY@c.us','ZZZZZZZZZ@c.us') 26 | ... 27 | ``` 28 | 29 | ## Listening to participant changes of a specific group 30 | 31 | You can react to when participants are added and removed. [[onParticipantsChanged]] emits a [[ParticipantChangedEventModel]]. 32 | 33 | ```javascript 34 | client.onParticipantsChanged("XXXXXXXX-YYYYYYYY@g.us", (participantChangedEvent) => console.log("participant changed for group", participantChangedEvent)); 35 | 36 | //participantChangedEvent returns 37 | { 38 | by: 'XXXXXXXXXXX@c.us', //who performed the action 39 | action: 'remove', 40 | who: [ 'XXXXXXXXX@c.us' ] //all the numbers the action effects. 41 | } 42 | ``` 43 | 44 | This solution can result in some false positives and misfires however a lot of effort has been made to mitigate this to a reasonable level. Best practice is to maintian a seperate registry of participants and go from that. 45 | 46 | ## Listen to participant changes globally 47 | 48 | [[onGlobalParticipantsChanged]] is a simple and memory efficient way to listen to all participant changes from all groups. This is an Insider's Feature. 49 | 50 | ```javascript 51 | client.onGlobalParticipantsChanged((participantChangedEvent) => console.log("participant changed for group", participantChangedEvent)); 52 | 53 | //participantChangedEvent returns 54 | { 55 | by: 'XXXXXXXXXXX@c.us', //who performed the action 56 | action: 'remove', 57 | who: [ 'XXXXXXXXX@c.us' ] //all the numbers the action effects. 58 | } 59 | ``` 60 | -------------------------------------------------------------------------------- /docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "docusaurus": "docusaurus", 7 | "start": "docusaurus start", 8 | "build": "docusaurus build", 9 | "swizzle": "docusaurus swizzle", 10 | "deploy": "docusaurus deploy", 11 | "clear": "docusaurus clear", 12 | "serve": "docusaurus serve", 13 | "write-translations": "docusaurus write-translations", 14 | "write-heading-ids": "docusaurus write-heading-ids", 15 | "deploy_with_ssh": "USE_SSH=true npm run deploy", 16 | "deploy_with_ssh_ci": "npm ci && npm i -D && npm run deploy", 17 | "typecheck": "tsc", 18 | "tw": "npx tailwindcss -i ./src/input.css -o ./src/output.css --watch" 19 | }, 20 | "dependencies": { 21 | "@docusaurus/core": "^3.7.0", 22 | "@docusaurus/preset-classic": "^3.7.0", 23 | "@docusaurus/theme-search-algolia": "^3.7.0", 24 | "@mdx-js/react": "^3.0.0", 25 | "@openreplay/tracker": "^15.0.3", 26 | "@radix-ui/react-icons": "^1.3.0", 27 | "@radix-ui/react-slot": "^1.1.0", 28 | "class-variance-authority": "^0.7.0", 29 | "clsx": "^2.1.1", 30 | "lucide-react": "^0.408.0", 31 | "posthog-docusaurus": "^2.0.1", 32 | "prism-react-renderer": "^2.3.0", 33 | "react": "^18.0.0", 34 | "react-dom": "^18.0.0", 35 | "replace-in-file": "^8.1.0", 36 | "tailwind-merge": "^2.4.0", 37 | "tailwindcss-animate": "^1.0.7" 38 | }, 39 | "devDependencies": { 40 | "@docusaurus/module-type-aliases": "^3.7.0", 41 | "@docusaurus/tsconfig": "^3.7.0", 42 | "@docusaurus/types": "^3.7.0", 43 | "autoprefixer": "^10.4.19", 44 | "docusaurus-plugin-typedoc": "^1.0.3", 45 | "docusaurus-plugin-typedoc-api": "^4.2.0", 46 | "postcss": "^8.4.39", 47 | "remark-gfm": "^4.0.0", 48 | "remark-parse": "^11.0.0", 49 | "tailwindcss": "^3.4.6", 50 | "typedoc": "^0.26.4", 51 | "typedoc-plugin-markdown": "^4.2.1", 52 | "typescript": "~5.2.2", 53 | "unified": "^11.0.5", 54 | "unist-util-visit": "^5.0.0" 55 | }, 56 | "browserslist": { 57 | "production": [ 58 | ">0.5%", 59 | "not dead", 60 | "not op_mini all" 61 | ], 62 | "development": [ 63 | "last 3 chrome version", 64 | "last 3 firefox version", 65 | "last 5 safari version" 66 | ] 67 | }, 68 | "engines": { 69 | "node": ">=18.0" 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /docs/src/components/HomepageFeatures/index.tsx: -------------------------------------------------------------------------------- 1 | import clsx from 'clsx'; 2 | import Heading from '@theme/Heading'; 3 | import styles from './styles.module.css'; 4 | import { cn } from '../../lib/utils'; 5 | 6 | type FeatureItem = { 7 | title: string; 8 | Svg: React.ComponentType>; 9 | description: JSX.Element; 10 | }; 11 | 12 | const FeatureList: FeatureItem[] = [ 13 | { 14 | title: 'Easy to Use', 15 | Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, 16 | description: ( 17 | <> 18 | The Easy API enables you to effortlessly turn your account into an API, configure automations and integrations without writing any code. 19 | 20 | ), 21 | }, 22 | { 23 | title: 'Reliable', 24 | Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default, 25 | description: ( 26 | <> 27 | @open-wa lets you focus on your docs, and we'll do the chores. Go 28 | ahead and move your docs into the docs directory. 29 | 30 | ), 31 | }, 32 | { 33 | title: 'First Class Integrations', 34 | Svg: require('@site/static/img/undraw_docusaurus_react.svg').default, 35 | description: ( 36 | <> 37 | Never worry about integrating with any other library again. We have a full suite of integrations for you from Chatwoot to Node Red. From S3 to Twillio. 38 | 39 | ), 40 | }, 41 | ]; 42 | 43 | function Feature({title, Svg, description}: FeatureItem) { 44 | return ( 45 |
46 |
47 | 48 |
49 |
50 | {title} 51 |

{description}

52 |
53 |
54 |
55 |
56 | ); 57 | } 58 | 59 | export default function HomepageFeatures(): JSX.Element { 60 | return ( 61 |
62 |
63 |
64 | {FeatureList.map((props, idx) => ( 65 | 66 | ))} 67 |
68 |
69 |
70 | ); 71 | } 72 | -------------------------------------------------------------------------------- /src/config/puppeteer.config.ts: -------------------------------------------------------------------------------- 1 | const puppeteerConfig = { 2 | WAUrl: 'https://web.whatsapp.com', 3 | width: 1440, 4 | height: 900, 5 | chromiumArgs: [ 6 | // `--app=${WAUrl}`, 7 | '--log-level=3', // fatal only 8 | //'--start-maximized', 9 | '--no-default-browser-check', 10 | '--disable-site-isolation-trials', 11 | '--no-experiments', 12 | '--ignore-gpu-blacklist', 13 | '--ignore-certificate-errors', 14 | '--ignore-certificate-errors-spki-list', 15 | '--disable-gpu', 16 | '--disable-extensions', 17 | '--disable-default-apps', 18 | '--enable-features=NetworkService', 19 | '--disable-setuid-sandbox', 20 | '--no-sandbox', 21 | // Extras 22 | '--disable-webgl', 23 | '--disable-infobars', 24 | '--window-position=0,0', 25 | '--ignore-certifcate-errors', 26 | '--ignore-certifcate-errors-spki-list', 27 | '--disable-threaded-animation', 28 | '--disable-threaded-scrolling', 29 | '--disable-in-process-stack-traces', 30 | '--disable-histogram-customizer', 31 | '--disable-gl-extensions', 32 | '--disable-composited-antialiasing', 33 | '--disable-session-crashed-bubble', 34 | '--disable-canvas-aa', 35 | '--disable-3d-apis', 36 | '--disable-accelerated-2d-canvas', 37 | '--disable-accelerated-jpeg-decoding', 38 | '--disable-accelerated-mjpeg-decode', 39 | '--disable-app-list-dismiss-on-blur', 40 | '--disable-accelerated-video-decode', 41 | '--disable-dev-shm-usage', 42 | '--js-flags=--expose-gc', 43 | // '--incognito', 44 | //suggested in #563 45 | // '--single-process', 46 | // '--no-zygote', 47 | // '--renderer-process-limit=1', 48 | // '--no-first-run' 49 | '--disable-features=site-per-process', 50 | '--disable-gl-drawing-for-tests', 51 | //keep awake in all situations 52 | '--disable-background-timer-throttling', 53 | '--disable-backgrounding-occluded-windows', 54 | '--disable-renderer-backgrounding' 55 | ] 56 | }; 57 | 58 | export const createUserAgent = (waVersion:string) : string => `WhatsApp/${waVersion} Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36`; 59 | export const useragent = createUserAgent('2.2147.16') 60 | export { puppeteerConfig }; 61 | 62 | export const width = puppeteerConfig.width; 63 | export const height = puppeteerConfig.height; --------------------------------------------------------------------------------