Skip to content

Development #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
54b4d7a
feat: New route to connect and get QrCode
joaomarcos-exe Jul 28, 2023
8104c30
fix: erro to send messages
joaomarcos-exe Aug 2, 2023
0644547
wip: Send template
joaomarcos-exe Aug 5, 2023
08df64f
feat: Route to disconnect whatsapp
joaomarcos-exe Aug 10, 2023
d6ae214
fix: Clear code
joaomarcos-exe Aug 10, 2023
89b8c7e
Update package.json new version UnoAPI e Baileys
wmilhomem Aug 10, 2023
17d4a8e
Updating README.md new parameters
wmilhomem Aug 10, 2023
c8125ef
Update config_by_env.ts include lib pino
wmilhomem Aug 10, 2023
55e67d7
Updating config.ts include lib pino and property ignoreDataStore
wmilhomem Aug 10, 2023
fbcb995
Updating store_file.ts include class authState
wmilhomem Aug 11, 2023
fb43944
Create auth_state.ts
wmilhomem Aug 11, 2023
687645a
Create session_file.ts
wmilhomem Aug 11, 2023
15127a4
Create session.ts
wmilhomem Aug 11, 2023
6ac08fa
Updating transformer.ts mime to mimetype
wmilhomem Aug 11, 2023
c3767b5
Updating transformer.ts unoapi_cloud por whatsapp_business_account
wmilhomem Aug 11, 2023
885cf98
Update transformer.ts
wmilhomem Aug 11, 2023
9440c62
fix: Problem with type
joaomarcos-exe Aug 11, 2023
945ed69
feat: Remove send messages of erro with message normal whatsapp
joaomarcos-exe Aug 14, 2023
4608367
feat: Return a erro if a phone that read qrCode is different of infor…
joaomarcos-exe Aug 22, 2023
3c75b5e
fix: Bug with regions of number whatsapp
joaomarcos-exe Aug 23, 2023
0c309c6
refactor: Add validation on contry
joaomarcos-exe Aug 23, 2023
198b3c6
refactor: Ignore history of conversations
joaomarcos-exe Aug 23, 2023
b05252a
fix: Error to send change status with a broker that dont exist
joaomarcos-exe Aug 29, 2023
3e152ea
fix: dont send ack to painel
joaomarcos-exe Aug 29, 2023
d241b70
fix: Erro when disconect by phone
joaomarcos-exe Aug 31, 2023
af8a4c8
fix: Problem when a client reply someone message
joaomarcos-exe Sep 1, 2023
ec2e27b
feat: health check
joaomarcos-exe Sep 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ docker-compose.yml
Dockerfile
develop.Dockerfile
README.md
.env
node_modules
yarn-error.log
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/discord.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/unoapi-cloud.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ REJECT_CALLS=message to send when receive a call, default is empty and not rejec
REJECT_CALLS_WEBHOOK=message to send webook when receive a call, default is empty and not send
SEND_CONNECTION_STATUS=true to send all connection status to webhook, false to send only important messages, default is true
UNOAPI_BASE_STORE=dir where save sessions, medias and stores. Defaul is ./data
IGNORE_DATA_STORE=ignore save/retrieve data(message, contacts, groups...)
LOG_LEVEL=log level, default warn
UNO_LOG_LEVEL=uno log level. default LOG_LEVEL
```

## Examples
Expand Down
24 changes: 24 additions & 0 deletions __tests__/services/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,4 +887,28 @@ describe('service transformer', () => {
}
expect(fromBaileysMessageContent(phoneNumer, input)).toEqual(output)
})

test('isValidPhoneNumber return true when 8 digits phone brazilian', async () => {
expect(isValidPhoneNumber('554988290955')).toEqual(true)
})

test('isValidPhoneNumber return true when 9 digits phone brazilian', async () => {
expect(isValidPhoneNumber('5549988290955')).toEqual(true)
})

test('isValidPhoneNumber return true when 8 digits phone brazilian with jid', async () => {
expect(isValidPhoneNumber('[email protected]')).toEqual(true)
})

test('isValidPhoneNumber return true when 9 digits phone brazilian with jid', async () => {
expect(isValidPhoneNumber('[email protected]')).toEqual(true)
})

test('isValidPhoneNumber return true when +', async () => {
expect(isValidPhoneNumber('+554988290955')).toEqual(true)
})

test('isValidPhoneNumber return false when invalid', async () => {
expect(isValidPhoneNumber('+554998416834X')).toEqual(false)
})
})
Empty file modified data/medias/.gitkeep
100644 → 100755
Empty file.
Empty file modified data/sessions/.gitkeep
100644 → 100755
Empty file.
Empty file modified data/stores/.gitkeep
100644 → 100755
Empty file.
16 changes: 6 additions & 10 deletions develop.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
FROM node:18-alpine
FROM node:18

RUN apk --update --no-cache add git
# RUN apk --update --no-cache add git

WORKDIR /app
ENV NODE_ENV development

ADD ./package.json ./package.json
ADD ./yarn.lock ./yarn.lock
RUN yarn
COPY . .
RUN npm run build

ADD ./tsconfig.json ./tsconfig.json
ADD ./src ./src
RUN yarn build

ENTRYPOINT yarn dev
ENTRYPOINT npm run dev
9 changes: 7 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'

services:
app:
app-unoapi:
build:
dockerfile: develop.Dockerfile
environment:
Expand All @@ -11,4 +11,9 @@ services:
working_dir: /app
command: yarn dev
ports:
- 9876:9876
- 9876:9876
networks:
- app-network
networks:
app-network:
external: true
Loading