Skip to content
This repository was archived by the owner on Nov 21, 2023. It is now read-only.

Commit f3779c1

Browse files
committed
operation - deleteMessage
1 parent 8475318 commit f3779c1

File tree

2 files changed

+133
-8
lines changed

2 files changed

+133
-8
lines changed

nodes/CodeChat/CodeChat.fields.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { INodeProperties } from 'n8n-workflow';
22
import {
33
blockCobtactProperties,
44
budinessProfileProperties,
5+
deleteMessageProperties,
56
markMSGReadProperties,
67
onWhatsappProperties,
78
profilePictureProperties,
@@ -206,6 +207,11 @@ const chatResource: INodeProperties[] = [
206207
value: 'contactStatus',
207208
action: 'Contact status a chat',
208209
},
210+
{
211+
name: 'Delete Message',
212+
value: 'deleteMessage',
213+
action: 'Delete message a chat',
214+
},
209215
{
210216
name: 'Mark Message As Read',
211217
value: 'markMessageAsRead',
@@ -255,6 +261,12 @@ const chatResource: INodeProperties[] = [
255261
*/
256262
...markMSGReadProperties,
257263

264+
/**┌────────────────────────────────────┐
265+
* │ Delete Messge Properties │
266+
* └────────────────────────────────────┘
267+
*/
268+
...deleteMessageProperties,
269+
258270
/**┌────────────────────────────────────┐
259271
* │ Block Contact Properties │
260272
* └────────────────────────────────────┘

nodes/CodeChat/descriptions/Chat.desc.ts

Lines changed: 121 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ export const onWhatsappProperties: INodeProperties[] = [
1212
hint: 'Check if the contact is a whatsapp contact. When entering a phone number, make sure to include the country code',
1313
routing: {
1414
send: { type: 'body', property: 'numbers', preSend: [formatNumber] },
15-
request: { url: '=' + requestURL('chat', 'onWhatsApp'), method: 'POST' },
15+
request: {
16+
url: '=' + requestURL('chat', 'onWhatsApp'),
17+
method: 'POST'
18+
},
1619
},
1720
displayOptions: {
1821
show: {
@@ -97,7 +100,12 @@ export const updatePresence: INodeProperties[] = [
97100
name: 'setRouting',
98101
type: 'hidden',
99102
default: '',
100-
routing: { request: { url: '=' + requestURL('chat', 'updatePresence'), method: 'PUT' } },
103+
routing: {
104+
request: {
105+
url: '=' + requestURL('chat', 'updatePresence'),
106+
method: 'PUT'
107+
}
108+
},
101109
displayOptions: {
102110
show: {
103111
resource: ['chat'],
@@ -117,7 +125,10 @@ export const markMSGReadProperties: INodeProperties[] = [
117125
placeholder: `[Array:[messageId:'id',wuid:'123@s.whatsapp.net',fromMe:false]]`,
118126
routing: {
119127
send: { type: 'body', property: 'readMessage', preSend: [readMessage] },
120-
request: { url: '=' + requestURL('chat', 'markMessageAsRead'), method: 'PUT' },
128+
request: {
129+
url: '=' + requestURL('chat', 'markMessageAsRead'),
130+
method: 'PUT'
131+
},
121132
},
122133
displayOptions: {
123134
show: {
@@ -128,6 +139,91 @@ export const markMSGReadProperties: INodeProperties[] = [
128139
},
129140
];
130141

142+
export const deleteMessageProperties: INodeProperties[] = [
143+
{
144+
displayName: 'Message ID',
145+
name: 'messgeIdProperty',
146+
required: true,
147+
type: 'string',
148+
default: '',
149+
placeholder: 'E10D3435A07F6111089C7875814A667F',
150+
routing: { send: {type:'body', property: 'messageId'} },
151+
displayOptions: {
152+
show: {
153+
resource: ['chat'],
154+
operation: ['deleteMessage']
155+
}
156+
}
157+
},
158+
159+
{
160+
displayName: 'De',
161+
name: 'fromMeProperty',
162+
required: true,
163+
type: 'boolean',
164+
default: true,
165+
placeholder: '',
166+
routing: { send: { type:'body', property:'fromMe' } },
167+
displayOptions: {
168+
show: {
169+
resource: ['chat'],
170+
operation: ['deleteMessage']
171+
}
172+
}
173+
},
174+
175+
{
176+
displayName: 'Wuid',
177+
name: 'wuidProperty',
178+
required: true,
179+
type: 'string',
180+
default: '',
181+
placeholder: '5531900000000@s.whatsapp.net',
182+
routing: { send: { type: 'body', property: 'wuid' } },
183+
displayOptions: {
184+
show: {
185+
resource: ['chat'],
186+
operation: ['deleteMessage']
187+
}
188+
}
189+
},
190+
191+
{
192+
displayName: 'Participant',
193+
name: 'participantProperty',
194+
type: 'string',
195+
default: '',
196+
placeholder: '5531900000000@s.whatsapp.net',
197+
description: 'Pass this property if it is a group message',
198+
routing: { send: { type: 'body', property: 'participant' } },
199+
displayOptions: {
200+
show: {
201+
resource: ['chat'],
202+
operation: ['deleteMessage']
203+
}
204+
}
205+
},
206+
207+
{
208+
displayName: 'Set Routing',
209+
name: 'setRouting',
210+
type: 'hidden',
211+
default: '',
212+
routing: {
213+
request: {
214+
url: '=' + requestURL('chat', 'deleteMessage'),
215+
method: 'DELETE'
216+
},
217+
},
218+
displayOptions: {
219+
show: {
220+
resource: ['chat'],
221+
operation: ['deleteMessage'],
222+
},
223+
},
224+
},
225+
];
226+
131227
export const blockCobtactProperties: INodeProperties[] = [
132228
{
133229
displayName: 'Phone Number',
@@ -168,7 +264,12 @@ export const blockCobtactProperties: INodeProperties[] = [
168264
name: 'setRouting',
169265
type: 'hidden',
170266
default: '',
171-
routing: { request: { url: '=' + requestURL('chat', 'blockContact'), method: 'PUT' } },
267+
routing: {
268+
request: {
269+
url: '=' + requestURL('chat', 'blockContact'),
270+
method: 'PUT'
271+
}
272+
},
172273
displayOptions: {
173274
show: {
174275
resource: ['chat'],
@@ -187,7 +288,10 @@ export const statusContactPorperties: INodeProperties[] = [
187288
default: '',
188289
routing: {
189290
send: { type: 'query', property: 'number' },
190-
request: { url: '=' + requestURL('chat', 'fetchStatusContact'), method: 'GET' },
291+
request: {
292+
url: '=' + requestURL('chat', 'fetchStatusContact'),
293+
method: 'GET'
294+
},
191295
},
192296
displayOptions: {
193297
show: {
@@ -208,7 +312,10 @@ export const updateStatusProperties: INodeProperties[] = [
208312
default: '',
209313
routing: {
210314
send: { type: 'body', property: 'status' },
211-
request: { url: '=' + requestURL('chat', 'updateStaus'), method: 'PUT' },
315+
request: {
316+
url: '=' + requestURL('chat', 'updateStaus'),
317+
method: 'PUT'
318+
},
212319
},
213320
displayOptions: {
214321
show: {
@@ -230,7 +337,10 @@ export const budinessProfileProperties: INodeProperties[] = [
230337
placeholder: '5531900000000',
231338
routing: {
232339
send: { type: 'query', property: 'number' },
233-
request: { url: '=' + requestURL('chat', 'fetchBusinessProfile'), method: 'GET' },
340+
request: {
341+
url: '=' + requestURL('chat', 'fetchBusinessProfile'),
342+
method: 'GET'
343+
},
234344
},
235345
displayOptions: {
236346
show: {
@@ -252,7 +362,10 @@ export const profilePictureProperties: INodeProperties[] = [
252362
placeholder: '5531900000000',
253363
routing: {
254364
send: { type: 'query', property: 'number' },
255-
request: { url: '=' + requestURL('chat', 'fetchProfilePictureUrl'), method: 'GET' },
365+
request: {
366+
url: '=' + requestURL('chat', 'fetchProfilePictureUrl'),
367+
method: 'GET'
368+
},
256369
},
257370
displayOptions: {
258371
show: {

0 commit comments

Comments
 (0)