Skip to content

Commit

Permalink
feat: delete message (#153)
Browse files Browse the repository at this point in the history
* feat: delete message

* feat: add FE and docs

* feat: update syntax using newest proto

* feat: update docs
  • Loading branch information
aldinokemal authored Jun 2, 2024
1 parent 7292058 commit 1f3948e
Show file tree
Hide file tree
Showing 17 changed files with 392 additions and 152 deletions.
60 changes: 51 additions & 9 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.0
info:
title: WhatsApp API MultiDevice
version: 3.11.0
version: 4.0.0
description: This API is used for sending whatsapp via API
servers:
- url: http://localhost:3000
Expand Down Expand Up @@ -200,7 +200,7 @@ paths:
summary: Send Message
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
Expand Down Expand Up @@ -427,7 +427,7 @@ paths:
summary: Send Contact
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
Expand Down Expand Up @@ -470,7 +470,7 @@ paths:
summary: Send Link
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
Expand Down Expand Up @@ -513,7 +513,7 @@ paths:
summary: Send Location
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
Expand Down Expand Up @@ -618,7 +618,49 @@ paths:
description: Message ID
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
phone:
type: string
example: '[email protected]'
description: Phone number with country code
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SendResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorBadRequest'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInternalServer'
/message/{message_id}/delete:
post:
operationId: deleteMessage
tags:
- message
summary: Delete Message
parameters:
- in: path
name: message_id
schema:
type: string
required: true
description: Message ID
requestBody:
content:
application/json:
schema:
type: object
properties:
Expand Down Expand Up @@ -660,7 +702,7 @@ paths:
description: Message ID
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
Expand Down Expand Up @@ -840,7 +882,7 @@ paths:
summary: Join group with link
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
Expand Down Expand Up @@ -874,7 +916,7 @@ paths:
summary: Leave group
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
Expand Down
101 changes: 53 additions & 48 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,38 +92,42 @@ docker run --detach --publish=3000:3000 --name=whatsapp --restart=always --volum
You can fork or edit this source code !

### Current API

- [Api Specification Document](https://bump.sh/aldinokemal/doc/go-whatsapp-web-multidevice)
- You can check [docs/openapi.yml](./docs/openapi.yaml) for detail API or paste to [SwaggerEditor](https://editor.swagger.io).
- You can check [docs/openapi.yml](./docs/openapi.yaml) for detail API or paste
to [SwaggerEditor](https://editor.swagger.io).
- Furthermore you can generate HTTP Client from this API using [openapi-generator](https://openapi-generator.tech/#try)

| Feature | Menu | Method | URL |
|---------|------------------------------|--------|-----------------------------|
|| Login | GET | /app/login |
|| Logout | GET | /app/logout |
|| Reconnect | GET | /app/reconnect |
|| User Info | GET | /user/info |
|| User Avatar | GET | /user/avatar |
|| User My Group List | GET | /user/my/groups |
|| User My Privacy Setting | GET | /user/my/privacy |
|| Send Message | POST | /send/message |
|| Send Image | POST | /send/image |
|| Send Audio | POST | /send/audio |
|| Send File | POST | /send/file |
|| Send Video | POST | /send/video |
|| Send Contact | POST | /send/contact |
|| Send Link | POST | /send/link |
|| Send Location | POST | /send/location |
|| Send Poll / Vote | POST | /send/poll |
|| Revoke Message | POST | /message/:message_id/revoke |
|| React Message | POST | /message/:message_id/react |
|| Edit Message | POST | /message/:message_id/update |
|| Join Group With Link | POST | /group/join-with-link |
|| Leave Group | POST | /group/leave |
|| Create Group | POST | /group |
|| Add Participants in Group | POST | /group/participants |
|| Remove Participant in Group | DELETE | /group/participants |
|| Promote Participant in Group | POST | /group/participants/promote |
|| Demote Participant in Group | POST | /group/participants/demote |
| Feature | Menu | Method | URL |
|---------|------------------------------|--------|-------------------------------|
|| Login | GET | /app/login |
|| Logout | GET | /app/logout |
|| Reconnect | GET | /app/reconnect |
|| Devices | GET | /app/devices |
|| User Info | GET | /user/info |
|| User Avatar | GET | /user/avatar |
|| User My Group List | GET | /user/my/groups |
|| User My Privacy Setting | GET | /user/my/privacy |
|| Send Message | POST | /send/message |
|| Send Image | POST | /send/image |
|| Send Audio | POST | /send/audio |
|| Send File | POST | /send/file |
|| Send Video | POST | /send/video |
|| Send Contact | POST | /send/contact |
|| Send Link | POST | /send/link |
|| Send Location | POST | /send/location |
|| Send Poll / Vote | POST | /send/poll |
|| Revoke Message | POST | /message/:message_id/revoke |
|| React Message | POST | /message/:message_id/reaction |
|| Delete Message | POST | /message/:message_id/delete |
|| Edit Message | POST | /message/:message_id/update |
|| Join Group With Link | POST | /group/join-with-link |
|| Leave Group | POST | /group/leave |
|| Create Group | POST | /group |
|| Add Participants in Group | POST | /group/participants |
|| Remove Participant in Group | DELETE | /group/participants |
|| Promote Participant in Group | POST | /group/participants/promote |
|| Demote Participant in Group | POST | /group/participants/demote |

```
✅ = Available
Expand All @@ -132,25 +136,26 @@ You can fork or edit this source code !

### App User Interface

1. Homepage ![Homepage](https://i.ibb.co/Wn3H1L9/homepage.png)
2. Login ![Login](https://i.ibb.co/jkcB15R/login.png?v=1)
3. Send Message ![Send Message](https://i.ibb.co/rc3NXMX/send-message.png?v1)
4. Send Image ![Send Image](https://i.ibb.co/BcFL3SD/send-image.png?v1)
5. Send File ![Send File](https://i.ibb.co/f4yxjpp/send-file.png)
6. Send Video ![Send Video](https://i.ibb.co/PrD3P51/send-video.png)
7. Send Contact ![Send Contact](https://i.ibb.co/4810H7N/send-contact.png)
8. Send Location ![Send Location](https://i.ibb.co/TWsy09G/send-location.png)
9. Send Audio ![Send Location](https://i.ibb.co/p1wL4wh/Send-Audio.png)
10. Send Poll ![Send Poll](https://i.ibb.co/mq2fGHz/send-poll.png)
11. Revoke Message ![Revoke Message](https://i.ibb.co/yswhvQY/revoke.png?v1)
12. Reaction Message ![Revoke Message](https://i.ibb.co/BfHgSHG/react-message.png)
13. Edit Message ![Edit Message](https://i.ibb.co/kXfpqJw/update-message.png)
14. User Info ![User Info](https://i.ibb.co/3zjX6Cz/user-info.png?v=1)
15. User Avatar ![User Avatar](https://i.ibb.co/ZmJZ4ZW/search-avatar.png?v=1)
16. My Privacy ![My Privacy](https://i.ibb.co/Cw1sMQz/my-privacy.png)
17. My Group ![My Group](https://i.ibb.co/WB268Xy/list-group.png)
18. Auto Reply ![Auto Reply](https://i.ibb.co/D4rTytX/IMG-20220517-162500.jpg)
19. Basic Auth Prompt ![Basic Auth](https://i.ibb.co/PDjQ92W/Screenshot-2022-11-06-at-14-06-29.png)
1. Homepage ![Homepage](https://i.ibb.co.com/681JTHK/image.png)
2. Login ![Login](https://i.ibb.co.com/jkcB15R/login.png?v=1)
3. Send Message ![Send Message](https://i.ibb.co.com/rc3NXMX/send-message.png?v1)
4. Send Image ![Send Image](https://i.ibb.co.com/BcFL3SD/send-image.png?v1)
5. Send File ![Send File](https://i.ibb.co.com/f4yxjpp/send-file.png)
6. Send Video ![Send Video](https://i.ibb.co.com/PrD3P51/send-video.png)
7. Send Contact ![Send Contact](https://i.ibb.co.com/4810H7N/send-contact.png)
8. Send Location ![Send Location](https://i.ibb.co.com/TWsy09G/send-location.png)
9. Send Audio ![Send Location](https://i.ibb.co.com/p1wL4wh/Send-Audio.png)
10. Send Poll ![Send Poll](https://i.ibb.co.com/mq2fGHz/send-poll.png)
11. Revoke Message ![Revoke Message](https://i.ibb.co.com/yswhvQY/revoke.png?v1)
12. Delete Message ![Delete Message](https://i.ibb.co.com/F70SZ84/image.png)
13. Reaction Message ![Revoke Message](https://i.ibb.co.com/BfHgSHG/react-message.png)
14. Edit Message ![Edit Message](https://i.ibb.co.com/kXfpqJw/update-message.png)
15. User Info ![User Info](https://i.ibb.co.com/3zjX6Cz/user-info.png?v=1)
16. User Avatar ![User Avatar](https://i.ibb.co.com/ZmJZ4ZW/search-avatar.png?v=1)
17. My Privacy ![My Privacy](https://i.ibb.co.com/Cw1sMQz/my-privacy.png)
18. My Group ![My Group](https://i.ibb.co.com/WB268Xy/list-group.png)
19. Auto Reply ![Auto Reply](https://i.ibb.co.com/D4rTytX/IMG-20220517-162500.jpg)
20. Basic Auth Prompt ![Basic Auth](https://i.ibb.co.com/PDjQ92W/Screenshot-2022-11-06-at-14-06-29.png)

### Mac OS NOTE

Expand Down
2 changes: 1 addition & 1 deletion src/config/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

var (
AppVersion = "v4.13.0"
AppVersion = "v4.14.0"
AppPort = "3000"
AppDebug = false
AppOs = "AldinoKemal"
Expand Down
34 changes: 31 additions & 3 deletions src/domains/message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,35 @@ package message
import "context"

type IMessageService interface {
ReactMessage(ctx context.Context, request ReactionRequest) (response ReactionResponse, err error)
RevokeMessage(ctx context.Context, request RevokeRequest) (response RevokeResponse, err error)
UpdateMessage(ctx context.Context, request UpdateMessageRequest) (response UpdateMessageResponse, err error)
ReactMessage(ctx context.Context, request ReactionRequest) (response GenericResponse, err error)
RevokeMessage(ctx context.Context, request RevokeRequest) (response GenericResponse, err error)
UpdateMessage(ctx context.Context, request UpdateMessageRequest) (response GenericResponse, err error)
DeleteMessage(ctx context.Context, request DeleteRequest) (err error)
}

type GenericResponse struct {
MessageID string `json:"message_id"`
Status string `json:"status"`
}

type RevokeRequest struct {
MessageID string `json:"message_id" uri:"message_id"`
Phone string `json:"phone" form:"phone"`
}

type DeleteRequest struct {
MessageID string `json:"message_id" uri:"message_id"`
Phone string `json:"phone" form:"phone"`
}

type ReactionRequest struct {
MessageID string `json:"message_id" form:"message_id"`
Phone string `json:"phone" form:"phone"`
Emoji string `json:"emoji" form:"emoji"`
}

type UpdateMessageRequest struct {
MessageID string `json:"message_id" uri:"message_id"`
Message string `json:"message" form:"message"`
Phone string `json:"phone" form:"phone"`
}
12 changes: 0 additions & 12 deletions src/domains/message/reaction.go

This file was deleted.

11 changes: 0 additions & 11 deletions src/domains/message/revoke.go

This file was deleted.

12 changes: 0 additions & 12 deletions src/domains/message/update.go

This file was deleted.

20 changes: 10 additions & 10 deletions src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/aldinokemal/go-whatsapp-web-multidevice
go 1.21

require (
github.com/PuerkitoBio/goquery v1.9.1
github.com/PuerkitoBio/goquery v1.9.2
github.com/disintegration/imaging v1.6.2
github.com/dustin/go-humanize v1.0.1
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
Expand All @@ -16,10 +16,10 @@ require (
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.9.0
github.com/valyala/fasthttp v1.52.0
github.com/valyala/fasthttp v1.54.0
go.mau.fi/libsignal v0.1.0
go.mau.fi/whatsmeow v0.0.0-20240327124018-350073db195c
google.golang.org/protobuf v1.33.0
go.mau.fi/whatsmeow v0.0.0-20240523075404-7f13c31d2cb1
google.golang.org/protobuf v1.34.1
)

require (
Expand All @@ -28,7 +28,7 @@ require (
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fasthttp/websocket v1.5.8 // indirect
github.com/fasthttp/websocket v1.5.9 // indirect
github.com/gofiber/template v1.8.3 // indirect
github.com/gofiber/utils v1.1.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
Expand All @@ -40,16 +40,16 @@ require (
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rs/zerolog v1.32.0 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/savsgio/gotils v0.0.0-20240303185622-093b76447511 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
go.mau.fi/util v0.4.2 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/image v0.15.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/image v0.16.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 1f3948e

Please sign in to comment.