diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 60533b8..e958ac1 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -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 @@ -200,7 +200,7 @@ paths: summary: Send Message requestBody: content: - multipart/form-data: + application/json: schema: type: object properties: @@ -427,7 +427,7 @@ paths: summary: Send Contact requestBody: content: - multipart/form-data: + application/json: schema: type: object properties: @@ -470,7 +470,7 @@ paths: summary: Send Link requestBody: content: - multipart/form-data: + application/json: schema: type: object properties: @@ -513,7 +513,7 @@ paths: summary: Send Location requestBody: content: - multipart/form-data: + application/json: schema: type: object properties: @@ -618,7 +618,49 @@ paths: description: Message ID requestBody: content: - multipart/form-data: + application/json: + schema: + type: object + properties: + phone: + type: string + example: '6289685024051@s.whatsapp.net' + 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: @@ -660,7 +702,7 @@ paths: description: Message ID requestBody: content: - multipart/form-data: + application/json: schema: type: object properties: @@ -840,7 +882,7 @@ paths: summary: Join group with link requestBody: content: - multipart/form-data: + application/json: schema: type: object properties: @@ -874,7 +916,7 @@ paths: summary: Leave group requestBody: content: - multipart/form-data: + application/json: schema: type: object properties: diff --git a/readme.md b/readme.md index 3ce80e8..227c7de 100644 --- a/readme.md +++ b/readme.md @@ -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 @@ -132,25 +136,26 @@ You can fork or edit this source code ! ### App User Interface -1. Homepage  -2. Login  -3. Send Message  -4. Send Image  -5. Send File  -6. Send Video  -7. Send Contact  -8. Send Location  -9. Send Audio  -10. Send Poll  -11. Revoke Message  -12. Reaction Message  -13. Edit Message  -14. User Info  -15. User Avatar  -16. My Privacy  -17. My Group  -18. Auto Reply  -19. Basic Auth Prompt  +1. Homepage  +2. Login  +3. Send Message  +4. Send Image  +5. Send File  +6. Send Video  +7. Send Contact  +8. Send Location  +9. Send Audio  +10. Send Poll  +11. Revoke Message  +12. Delete Message  +13. Reaction Message  +14. Edit Message  +15. User Info  +16. User Avatar  +17. My Privacy  +18. My Group  +19. Auto Reply  +20. Basic Auth Prompt  ### Mac OS NOTE diff --git a/src/config/settings.go b/src/config/settings.go index 6e40818..9d9458e 100644 --- a/src/config/settings.go +++ b/src/config/settings.go @@ -5,7 +5,7 @@ import ( ) var ( - AppVersion = "v4.13.0" + AppVersion = "v4.14.0" AppPort = "3000" AppDebug = false AppOs = "AldinoKemal" diff --git a/src/views/components/MessageDelete.js b/src/views/components/MessageDelete.js new file mode 100644 index 0000000..cb6f46d --- /dev/null +++ b/src/views/components/MessageDelete.js @@ -0,0 +1,106 @@ +export default { + name: 'DeleteMessage', + data() { + return { + type: 'user', + phone: '', + message_id: '', + loading: false, + } + }, + computed: { + phone_id() { + return this.type === 'user' ? `${this.phone}@${window.TYPEUSER}` : `${this.phone}@${window.TYPEGROUP}` + } + }, + methods: { + openModal() { + $('#modalMessageDelete').modal({ + onApprove: function () { + return false; + } + }).modal('show'); + }, + async handleSubmit() { + try { + let response = await this.submitApi() + showSuccessInfo(response) + $('#modalMessageDelete').modal('hide'); + } catch (err) { + showErrorInfo(err) + } + }, + async submitApi() { + this.loading = true; + try { + const payload = {phone: this.phone_id, message: this.new_message} + + let response = await window.http.post(`/message/${this.message_id}/delete`, payload) + this.handleReset(); + return response.data.message; + } catch (error) { + if (error.response) { + throw new Error(error.response.data.message); + } + throw new Error(error.message); + } finally { + this.loading = false; + } + }, + handleReset() { + this.type = 'user'; + this.phone = ''; + this.message_id = ''; + this.new_message = ''; + this.loading = false; + }, + }, + template: ` +