piece-signal-cli-rest-api 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/package.json +26 -4
  2. package/src/index.d.ts +8 -0
  3. package/src/index.js +90 -0
  4. package/src/index.js.map +1 -0
  5. package/src/lib/actions/add-admins-to-group.d.ts +12 -0
  6. package/src/lib/actions/add-admins-to-group.js +45 -0
  7. package/src/lib/actions/add-admins-to-group.js.map +1 -0
  8. package/src/lib/actions/add-device.d.ts +11 -0
  9. package/src/lib/actions/add-device.js +40 -0
  10. package/src/lib/actions/add-device.js.map +1 -0
  11. package/src/lib/actions/add-members-to-group.d.ts +12 -0
  12. package/src/lib/actions/add-members-to-group.js +45 -0
  13. package/src/lib/actions/add-members-to-group.js.map +1 -0
  14. package/src/lib/actions/block-group.d.ts +11 -0
  15. package/src/lib/actions/block-group.js +37 -0
  16. package/src/lib/actions/block-group.js.map +1 -0
  17. package/src/lib/actions/create-group.d.ts +18 -0
  18. package/src/lib/actions/create-group.js +117 -0
  19. package/src/lib/actions/create-group.js.map +1 -0
  20. package/src/lib/actions/delete-group.d.ts +11 -0
  21. package/src/lib/actions/delete-group.js +37 -0
  22. package/src/lib/actions/delete-group.js.map +1 -0
  23. package/src/lib/actions/get-contact.d.ts +11 -0
  24. package/src/lib/actions/get-contact.js +37 -0
  25. package/src/lib/actions/get-contact.js.map +1 -0
  26. package/src/lib/actions/get-group.d.ts +11 -0
  27. package/src/lib/actions/get-group.js +37 -0
  28. package/src/lib/actions/get-group.js.map +1 -0
  29. package/src/lib/actions/get-qr-code-link.d.ts +11 -0
  30. package/src/lib/actions/get-qr-code-link.js +60 -0
  31. package/src/lib/actions/get-qr-code-link.js.map +1 -0
  32. package/src/lib/actions/join-group.d.ts +11 -0
  33. package/src/lib/actions/join-group.js +37 -0
  34. package/src/lib/actions/join-group.js.map +1 -0
  35. package/src/lib/actions/list-accounts.d.ts +8 -0
  36. package/src/lib/actions/list-accounts.js +23 -0
  37. package/src/lib/actions/list-accounts.js.map +1 -0
  38. package/src/lib/actions/list-attachments.d.ts +8 -0
  39. package/src/lib/actions/list-attachments.js +23 -0
  40. package/src/lib/actions/list-attachments.js.map +1 -0
  41. package/src/lib/actions/list-contacts.d.ts +10 -0
  42. package/src/lib/actions/list-contacts.js +32 -0
  43. package/src/lib/actions/list-contacts.js.map +1 -0
  44. package/src/lib/actions/list-devices.d.ts +10 -0
  45. package/src/lib/actions/list-devices.js +32 -0
  46. package/src/lib/actions/list-devices.js.map +1 -0
  47. package/src/lib/actions/list-groups.d.ts +10 -0
  48. package/src/lib/actions/list-groups.js +32 -0
  49. package/src/lib/actions/list-groups.js.map +1 -0
  50. package/src/lib/actions/list-identities.d.ts +10 -0
  51. package/src/lib/actions/list-identities.js +32 -0
  52. package/src/lib/actions/list-identities.js.map +1 -0
  53. package/src/lib/actions/quit-group.d.ts +11 -0
  54. package/src/lib/actions/quit-group.js +37 -0
  55. package/src/lib/actions/quit-group.js.map +1 -0
  56. package/src/lib/actions/receive-messages.d.ts +15 -0
  57. package/src/lib/actions/receive-messages.js +100 -0
  58. package/src/lib/actions/receive-messages.js.map +1 -0
  59. package/src/lib/actions/remote-delete-message.d.ts +12 -0
  60. package/src/lib/actions/remote-delete-message.js +46 -0
  61. package/src/lib/actions/remote-delete-message.js.map +1 -0
  62. package/src/lib/actions/remove-admins-from-group.d.ts +12 -0
  63. package/src/lib/actions/remove-admins-from-group.js +45 -0
  64. package/src/lib/actions/remove-admins-from-group.js.map +1 -0
  65. package/src/lib/actions/remove-device.d.ts +11 -0
  66. package/src/lib/actions/remove-device.js +37 -0
  67. package/src/lib/actions/remove-device.js.map +1 -0
  68. package/src/lib/actions/remove-members-from-group.d.ts +12 -0
  69. package/src/lib/actions/remove-members-from-group.js +45 -0
  70. package/src/lib/actions/remove-members-from-group.js.map +1 -0
  71. package/src/lib/actions/remove-reaction.d.ts +13 -0
  72. package/src/lib/actions/remove-reaction.js +52 -0
  73. package/src/lib/actions/remove-reaction.js.map +1 -0
  74. package/src/lib/actions/request-approval-message.d.ts +15 -0
  75. package/src/lib/actions/request-approval-message.js +184 -0
  76. package/src/lib/actions/request-approval-message.js.map +1 -0
  77. package/src/lib/actions/resume-approval-flow.d.ts +11 -0
  78. package/src/lib/actions/resume-approval-flow.js +181 -0
  79. package/src/lib/actions/resume-approval-flow.js.map +1 -0
  80. package/src/lib/actions/search-numbers.d.ts +11 -0
  81. package/src/lib/actions/search-numbers.js +42 -0
  82. package/src/lib/actions/search-numbers.js.map +1 -0
  83. package/src/lib/actions/send-message.d.ts +27 -0
  84. package/src/lib/actions/send-message.js +176 -0
  85. package/src/lib/actions/send-message.js.map +1 -0
  86. package/src/lib/actions/send-reaction.d.ts +14 -0
  87. package/src/lib/actions/send-reaction.js +58 -0
  88. package/src/lib/actions/send-reaction.js.map +1 -0
  89. package/src/lib/actions/send-receipt.d.ts +13 -0
  90. package/src/lib/actions/send-receipt.js +58 -0
  91. package/src/lib/actions/send-receipt.js.map +1 -0
  92. package/src/lib/actions/start-typing.d.ts +11 -0
  93. package/src/lib/actions/start-typing.js +40 -0
  94. package/src/lib/actions/start-typing.js.map +1 -0
  95. package/src/lib/actions/stop-typing.d.ts +11 -0
  96. package/src/lib/actions/stop-typing.js +40 -0
  97. package/src/lib/actions/stop-typing.js.map +1 -0
  98. package/src/lib/actions/sync-contacts.d.ts +10 -0
  99. package/src/lib/actions/sync-contacts.js +32 -0
  100. package/src/lib/actions/sync-contacts.js.map +1 -0
  101. package/src/lib/actions/update-account-settings.d.ts +12 -0
  102. package/src/lib/actions/update-account-settings.js +49 -0
  103. package/src/lib/actions/update-account-settings.js.map +1 -0
  104. package/src/lib/actions/update-contact.d.ts +13 -0
  105. package/src/lib/actions/update-contact.js +56 -0
  106. package/src/lib/actions/update-contact.js.map +1 -0
  107. package/src/lib/actions/update-group.d.ts +19 -0
  108. package/src/lib/actions/update-group.js +125 -0
  109. package/src/lib/actions/update-group.js.map +1 -0
  110. package/src/lib/actions/update-profile.d.ts +13 -0
  111. package/src/lib/actions/update-profile.js +56 -0
  112. package/src/lib/actions/update-profile.js.map +1 -0
  113. package/src/lib/common/api-client.d.ts +24 -0
  114. package/src/lib/common/api-client.js +103 -0
  115. package/src/lib/common/api-client.js.map +1 -0
  116. package/src/lib/common/auth.d.ts +8 -0
  117. package/src/lib/common/auth.js +68 -0
  118. package/src/lib/common/auth.js.map +1 -0
  119. package/src/lib/common/message-utils.d.ts +81 -0
  120. package/src/lib/common/message-utils.js +327 -0
  121. package/src/lib/common/message-utils.js.map +1 -0
  122. package/src/lib/common/types.d.ts +65 -0
  123. package/src/lib/common/types.js +3 -0
  124. package/src/lib/common/types.js.map +1 -0
  125. package/src/lib/common/utils.d.ts +23 -0
  126. package/src/lib/common/utils.js +105 -0
  127. package/src/lib/common/utils.js.map +1 -0
  128. package/src/lib/triggers/new-group-member.d.ts +50 -0
  129. package/src/lib/triggers/new-group-member.js +155 -0
  130. package/src/lib/triggers/new-group-member.js.map +1 -0
  131. package/src/lib/triggers/new-message-received.d.ts +58 -0
  132. package/src/lib/triggers/new-message-received.js +469 -0
  133. package/src/lib/triggers/new-message-received.js.map +1 -0
  134. package/project.json +0 -58
  135. package/src/index.ts +0 -87
  136. package/src/lib/actions/add-admins-to-group.ts +0 -50
  137. package/src/lib/actions/add-device.ts +0 -45
  138. package/src/lib/actions/add-members-to-group.ts +0 -50
  139. package/src/lib/actions/block-group.ts +0 -36
  140. package/src/lib/actions/create-group.ts +0 -139
  141. package/src/lib/actions/delete-group.ts +0 -36
  142. package/src/lib/actions/get-contact.ts +0 -42
  143. package/src/lib/actions/get-group.ts +0 -37
  144. package/src/lib/actions/get-qr-code-link.ts +0 -62
  145. package/src/lib/actions/join-group.ts +0 -36
  146. package/src/lib/actions/list-accounts.ts +0 -20
  147. package/src/lib/actions/list-attachments.ts +0 -20
  148. package/src/lib/actions/list-contacts.ts +0 -37
  149. package/src/lib/actions/list-devices.ts +0 -38
  150. package/src/lib/actions/list-groups.ts +0 -32
  151. package/src/lib/actions/list-identities.ts +0 -32
  152. package/src/lib/actions/quit-group.ts +0 -36
  153. package/src/lib/actions/receive-messages.ts +0 -108
  154. package/src/lib/actions/remote-delete-message.ts +0 -56
  155. package/src/lib/actions/remove-admins-from-group.ts +0 -50
  156. package/src/lib/actions/remove-device.ts +0 -36
  157. package/src/lib/actions/remove-members-from-group.ts +0 -50
  158. package/src/lib/actions/remove-reaction.ts +0 -59
  159. package/src/lib/actions/request-approval-message.ts +0 -215
  160. package/src/lib/actions/search-numbers.ts +0 -47
  161. package/src/lib/actions/send-message.ts +0 -189
  162. package/src/lib/actions/send-reaction.ts +0 -66
  163. package/src/lib/actions/send-receipt.ts +0 -65
  164. package/src/lib/actions/start-typing.ts +0 -45
  165. package/src/lib/actions/stop-typing.ts +0 -45
  166. package/src/lib/actions/sync-contacts.ts +0 -31
  167. package/src/lib/actions/update-account-settings.ts +0 -57
  168. package/src/lib/actions/update-contact.ts +0 -65
  169. package/src/lib/actions/update-group.ts +0 -145
  170. package/src/lib/actions/update-profile.ts +0 -65
  171. package/src/lib/common/api-client.ts +0 -150
  172. package/src/lib/common/auth.ts +0 -66
  173. package/src/lib/common/message-utils.ts +0 -449
  174. package/src/lib/common/types.ts +0 -73
  175. package/src/lib/common/utils.ts +0 -106
  176. package/src/lib/triggers/new-group-member.ts +0 -176
  177. package/src/lib/triggers/new-message-received.ts +0 -618
  178. package/tsconfig.json +0 -19
  179. package/tsconfig.lib.json +0 -11
@@ -1,47 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { signalCliRestApiAuth } from '../common/auth';
3
- import { SignalCliApiClient } from '../common/api-client';
4
- import { formatPhoneNumber } from '../common/utils';
5
-
6
- interface SearchResponse {
7
- number: string;
8
- registered: boolean;
9
- }
10
-
11
- export const searchNumbers = createAction({
12
- auth: signalCliRestApiAuth,
13
- name: 'searchNumbers',
14
- displayName: 'Search Numbers',
15
- description: 'Check if one or more phone numbers are registered with Signal',
16
- props: {
17
- number: Property.ShortText({
18
- displayName: 'Phone Number',
19
- description: 'Registered phone number in international format',
20
- required: true,
21
- }),
22
- numbers: Property.Array({
23
- displayName: 'Numbers to Check',
24
- description: 'Array of phone numbers to check',
25
- required: true,
26
- }),
27
- },
28
- async run(context) {
29
- const { number, numbers } = context.propsValue;
30
- // Auth props are passed directly to API client
31
-
32
- const apiClient = new SignalCliApiClient(context.auth.props);
33
- const formattedNumber = formatPhoneNumber(number);
34
-
35
- // Build query parameters
36
- const queryParams = new URLSearchParams();
37
- (numbers as string[]).forEach((num) => {
38
- queryParams.append('numbers', num);
39
- });
40
-
41
- const response = await apiClient.get<SearchResponse[]>(
42
- `/v1/search/${encodeURIComponent(formattedNumber)}?${queryParams.toString()}`
43
- );
44
-
45
- return response;
46
- },
47
- });
@@ -1,189 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { signalCliRestApiAuth } from '../common/auth';
3
- import { SignalCliApiClient } from '../common/api-client';
4
- import { SendMessageV2Request, SendMessageResponse, MessageMention, LinkPreviewType } from '../common/types';
5
- import { commonProps, formatPhoneNumber, normalizeBase64Attachment } from '../common/utils';
6
-
7
- export const sendMessage = createAction({
8
- auth: signalCliRestApiAuth,
9
- name: 'sendMessage',
10
- displayName: 'Send Message',
11
- description: 'Send a message via Signal (v2 API)',
12
- props: {
13
- number: Property.ShortText({
14
- displayName: 'Phone Number',
15
- description: 'Registered phone number in international format (e.g., +43123456789). If not provided, uses the default number from the connection.',
16
- required: false,
17
- }),
18
- recipients: commonProps.recipients,
19
- message: commonProps.message,
20
- base64_attachments: Property.Array({
21
- displayName: 'Attachments',
22
- description: 'Array of base64-encoded attachments. Can be plain base64 strings or data URLs.',
23
- required: false,
24
- }),
25
- sticker: Property.ShortText({
26
- displayName: 'Sticker',
27
- description: 'Sticker to send (format: pack_id:sticker_id)',
28
- required: false,
29
- }),
30
- mentions: Property.Array({
31
- displayName: 'Mentions',
32
- description: 'Array of mentions in the message',
33
- required: false,
34
- }),
35
- quote_timestamp: Property.Number({
36
- displayName: 'Quote Timestamp',
37
- description: 'Timestamp of the message to quote',
38
- required: false,
39
- }),
40
- quote_author: Property.ShortText({
41
- displayName: 'Quote Author',
42
- description: 'Author of the quoted message',
43
- required: false,
44
- }),
45
- quote_message: Property.LongText({
46
- displayName: 'Quote Message',
47
- description: 'Text of the quoted message',
48
- required: false,
49
- }),
50
- quote_mentions: Property.Array({
51
- displayName: 'Quote Mentions',
52
- description: 'Mentions in the quoted message',
53
- required: false,
54
- }),
55
- text_mode: Property.StaticDropdown({
56
- displayName: 'Text Mode',
57
- description: 'Text formatting mode',
58
- required: false,
59
- options: {
60
- options: [
61
- { label: 'Normal', value: 'normal' },
62
- { label: 'Styled', value: 'styled' },
63
- ],
64
- },
65
- }),
66
- edit_timestamp: Property.Number({
67
- displayName: 'Edit Timestamp',
68
- description: 'Timestamp of the message to edit',
69
- required: false,
70
- }),
71
- notify_self: Property.Checkbox({
72
- displayName: 'Notify Self',
73
- description: 'Send notification to yourself',
74
- required: false,
75
- }),
76
- link_preview_url: Property.ShortText({
77
- displayName: 'Link Preview URL',
78
- description: 'URL for link preview',
79
- required: false,
80
- }),
81
- link_preview_title: Property.ShortText({
82
- displayName: 'Link Preview Title',
83
- description: 'Title for link preview',
84
- required: false,
85
- }),
86
- link_preview_description: Property.LongText({
87
- displayName: 'Link Preview Description',
88
- description: 'Description for link preview',
89
- required: false,
90
- }),
91
- link_preview_base64_thumbnail: Property.LongText({
92
- displayName: 'Link Preview Thumbnail (Base64)',
93
- description: 'Base64-encoded thumbnail for link preview',
94
- required: false,
95
- }),
96
- view_once: Property.Checkbox({
97
- displayName: 'View Once',
98
- description: 'Send as view-once message (only for image attachments)',
99
- required: false,
100
- }),
101
- },
102
- async run(context) {
103
- const { number, recipients, message, base64_attachments, sticker, mentions, quote_timestamp, quote_author, quote_message, quote_mentions, text_mode, edit_timestamp, notify_self, link_preview_url, link_preview_title, link_preview_description, link_preview_base64_thumbnail, view_once } = context.propsValue;
104
-
105
- const apiClient = new SignalCliApiClient(context.auth.props);
106
-
107
- // Use number from props or fallback to default from connection
108
- const phoneNumber = number || context.auth.props.defaultNumber;
109
- if (!phoneNumber) {
110
- throw new Error('Phone number is required. Please provide it in the action or set a default in the connection settings.');
111
- }
112
-
113
- // Format phone number
114
- const formattedNumber = formatPhoneNumber(phoneNumber);
115
-
116
- // Prepare request body
117
- const requestBody: SendMessageV2Request = {
118
- number: formattedNumber,
119
- recipients: recipients as string[],
120
- message: message || '',
121
- };
122
-
123
- // Add optional fields
124
- if (base64_attachments && base64_attachments.length > 0) {
125
- requestBody.base64_attachments = (base64_attachments as string[]).map(normalizeBase64Attachment);
126
- }
127
-
128
- if (sticker) {
129
- requestBody.sticker = sticker;
130
- }
131
-
132
- if (mentions && mentions.length > 0) {
133
- requestBody.mentions = mentions as MessageMention[];
134
- }
135
-
136
- if (quote_timestamp) {
137
- requestBody.quote_timestamp = quote_timestamp;
138
- }
139
-
140
- if (quote_author) {
141
- requestBody.quote_author = quote_author;
142
- }
143
-
144
- if (quote_message) {
145
- requestBody.quote_message = quote_message;
146
- }
147
-
148
- if (quote_mentions && quote_mentions.length > 0) {
149
- requestBody.quote_mentions = quote_mentions as MessageMention[];
150
- }
151
-
152
- if (text_mode) {
153
- requestBody.text_mode = text_mode as 'normal' | 'styled';
154
- }
155
-
156
- if (edit_timestamp) {
157
- requestBody.edit_timestamp = edit_timestamp;
158
- }
159
-
160
- if (notify_self !== undefined) {
161
- requestBody.notify_self = notify_self;
162
- }
163
-
164
- if (link_preview_url || link_preview_title || link_preview_description || link_preview_base64_thumbnail) {
165
- const linkPreview: LinkPreviewType = {
166
- url: link_preview_url || '',
167
- title: link_preview_title || '',
168
- };
169
- if (link_preview_title) {
170
- linkPreview.title = link_preview_title;
171
- }
172
- if (link_preview_description) {
173
- linkPreview.description = link_preview_description;
174
- }
175
- if (link_preview_base64_thumbnail) {
176
- linkPreview.base64_thumbnail = normalizeBase64Attachment(link_preview_base64_thumbnail);
177
- }
178
- requestBody.link_preview = linkPreview;
179
- }
180
-
181
- if (view_once !== undefined) {
182
- requestBody.view_once = view_once;
183
- }
184
-
185
- const response = await apiClient.post<SendMessageResponse>('/v2/send', requestBody);
186
-
187
- return response;
188
- },
189
- });
@@ -1,66 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { signalCliRestApiAuth } from '../common/auth';
3
- import { SignalCliApiClient } from '../common/api-client';
4
- import { formatPhoneNumber } from '../common/utils';
5
-
6
- interface ReactionRequest {
7
- recipient: string;
8
- reaction: string;
9
- target_author: string;
10
- timestamp: number;
11
- }
12
-
13
- export const sendReaction = createAction({
14
- auth: signalCliRestApiAuth,
15
- name: 'sendReaction',
16
- displayName: 'Send Reaction',
17
- description: 'React to a message with an emoji',
18
- props: {
19
- number: Property.ShortText({
20
- displayName: 'Phone Number',
21
- description: 'Registered phone number in international format',
22
- required: true,
23
- }),
24
- recipient: Property.ShortText({
25
- displayName: 'Recipient',
26
- description: 'Phone number or group ID of the recipient',
27
- required: true,
28
- }),
29
- reaction: Property.ShortText({
30
- displayName: 'Reaction',
31
- description: 'Emoji reaction (e.g., 👍, ❤️)',
32
- required: true,
33
- }),
34
- target_author: Property.ShortText({
35
- displayName: 'Target Author',
36
- description: 'Phone number of the message author',
37
- required: true,
38
- }),
39
- timestamp: Property.Number({
40
- displayName: 'Timestamp',
41
- description: 'Timestamp of the message to react to',
42
- required: true,
43
- }),
44
- },
45
- async run(context) {
46
- const { number, recipient, reaction, target_author, timestamp } = context.propsValue;
47
- // Auth props are passed directly to API client
48
-
49
- const apiClient = new SignalCliApiClient(context.auth.props);
50
- const formattedNumber = formatPhoneNumber(number);
51
-
52
- const requestBody: ReactionRequest = {
53
- recipient,
54
- reaction,
55
- target_author,
56
- timestamp,
57
- };
58
-
59
- await apiClient.post(
60
- `/v1/reactions/${encodeURIComponent(formattedNumber)}`,
61
- requestBody
62
- );
63
-
64
- return { success: true };
65
- },
66
- });
@@ -1,65 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { signalCliRestApiAuth } from '../common/auth';
3
- import { SignalCliApiClient } from '../common/api-client';
4
- import { formatPhoneNumber } from '../common/utils';
5
-
6
- interface ReceiptRequest {
7
- recipient: string;
8
- receipt_type: 'read' | 'viewed';
9
- timestamp: number;
10
- }
11
-
12
- export const sendReceipt = createAction({
13
- auth: signalCliRestApiAuth,
14
- name: 'sendReceipt',
15
- displayName: 'Send Receipt',
16
- description: 'Send a read or viewed receipt for a message',
17
- props: {
18
- number: Property.ShortText({
19
- displayName: 'Phone Number',
20
- description: 'Registered phone number in international format',
21
- required: true,
22
- }),
23
- recipient: Property.ShortText({
24
- displayName: 'Recipient',
25
- description: 'Phone number or group ID of the recipient',
26
- required: true,
27
- }),
28
- receipt_type: Property.StaticDropdown({
29
- displayName: 'Receipt Type',
30
- description: 'Type of receipt to send',
31
- required: true,
32
- options: {
33
- options: [
34
- { label: 'Read', value: 'read' },
35
- { label: 'Viewed', value: 'viewed' },
36
- ],
37
- },
38
- }),
39
- timestamp: Property.Number({
40
- displayName: 'Timestamp',
41
- description: 'Timestamp of the message',
42
- required: true,
43
- }),
44
- },
45
- async run(context) {
46
- const { number, recipient, receipt_type, timestamp } = context.propsValue;
47
- // Auth props are passed directly to API client
48
-
49
- const apiClient = new SignalCliApiClient(context.auth.props);
50
- const formattedNumber = formatPhoneNumber(number);
51
-
52
- const requestBody: ReceiptRequest = {
53
- recipient,
54
- receipt_type: receipt_type as 'read' | 'viewed',
55
- timestamp,
56
- };
57
-
58
- await apiClient.post(
59
- `/v1/receipts/${encodeURIComponent(formattedNumber)}`,
60
- requestBody
61
- );
62
-
63
- return { success: true };
64
- },
65
- });
@@ -1,45 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { signalCliRestApiAuth } from '../common/auth';
3
- import { SignalCliApiClient } from '../common/api-client';
4
- import { formatPhoneNumber } from '../common/utils';
5
-
6
- interface TypingIndicatorRequest {
7
- recipient: string;
8
- }
9
-
10
- export const startTyping = createAction({
11
- auth: signalCliRestApiAuth,
12
- name: 'startTyping',
13
- displayName: 'Start Typing Indicator',
14
- description: 'Show typing indicator to a recipient',
15
- props: {
16
- number: Property.ShortText({
17
- displayName: 'Phone Number',
18
- description: 'Registered phone number in international format',
19
- required: true,
20
- }),
21
- recipient: Property.ShortText({
22
- displayName: 'Recipient',
23
- description: 'Phone number or group ID of the recipient',
24
- required: true,
25
- }),
26
- },
27
- async run(context) {
28
- const { number, recipient } = context.propsValue;
29
- // Auth props are passed directly to API client
30
-
31
- const apiClient = new SignalCliApiClient(context.auth.props);
32
- const formattedNumber = formatPhoneNumber(number);
33
-
34
- const requestBody: TypingIndicatorRequest = {
35
- recipient,
36
- };
37
-
38
- await apiClient.put(
39
- `/v1/typing-indicator/${encodeURIComponent(formattedNumber)}`,
40
- requestBody
41
- );
42
-
43
- return { success: true };
44
- },
45
- });
@@ -1,45 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { signalCliRestApiAuth } from '../common/auth';
3
- import { SignalCliApiClient } from '../common/api-client';
4
- import { formatPhoneNumber } from '../common/utils';
5
-
6
- interface TypingIndicatorRequest {
7
- recipient: string;
8
- }
9
-
10
- export const stopTyping = createAction({
11
- auth: signalCliRestApiAuth,
12
- name: 'stopTyping',
13
- displayName: 'Stop Typing Indicator',
14
- description: 'Hide typing indicator from a recipient',
15
- props: {
16
- number: Property.ShortText({
17
- displayName: 'Phone Number',
18
- description: 'Registered phone number in international format',
19
- required: true,
20
- }),
21
- recipient: Property.ShortText({
22
- displayName: 'Recipient',
23
- description: 'Phone number or group ID of the recipient',
24
- required: true,
25
- }),
26
- },
27
- async run(context) {
28
- const { number, recipient } = context.propsValue;
29
- // Auth props are passed directly to API client
30
-
31
- const apiClient = new SignalCliApiClient(context.auth.props);
32
- const formattedNumber = formatPhoneNumber(number);
33
-
34
- const requestBody: TypingIndicatorRequest = {
35
- recipient,
36
- };
37
-
38
- await apiClient.delete(
39
- `/v1/typing-indicator/${encodeURIComponent(formattedNumber)}`,
40
- requestBody
41
- );
42
-
43
- return { success: true };
44
- },
45
- });
@@ -1,31 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { signalCliRestApiAuth } from '../common/auth';
3
- import { SignalCliApiClient } from '../common/api-client';
4
- import { formatPhoneNumber } from '../common/utils';
5
-
6
- export const syncContacts = createAction({
7
- auth: signalCliRestApiAuth,
8
- name: 'syncContacts',
9
- displayName: 'Sync Contacts',
10
- description: 'Send a synchronization message with the local contacts list to all linked devices',
11
- props: {
12
- number: Property.ShortText({
13
- displayName: 'Phone Number',
14
- description: 'Registered phone number in international format',
15
- required: true,
16
- }),
17
- },
18
- async run(context) {
19
- const { number } = context.propsValue;
20
- // Auth props are passed directly to API client
21
-
22
- const apiClient = new SignalCliApiClient(context.auth.props);
23
- const formattedNumber = formatPhoneNumber(number);
24
-
25
- await apiClient.post(
26
- `/v1/contacts/${encodeURIComponent(formattedNumber)}/sync`
27
- );
28
-
29
- return { success: true };
30
- },
31
- });
@@ -1,57 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { signalCliRestApiAuth } from '../common/auth';
3
- import { SignalCliApiClient } from '../common/api-client';
4
- import { formatPhoneNumber } from '../common/utils';
5
-
6
- interface UpdateAccountSettingsRequest {
7
- discoverable_by_number?: boolean;
8
- share_number?: boolean;
9
- }
10
-
11
- export const updateAccountSettings = createAction({
12
- auth: signalCliRestApiAuth,
13
- name: 'updateAccountSettings',
14
- displayName: 'Update Account Settings',
15
- description: 'Update account attributes on the Signal server',
16
- props: {
17
- number: Property.ShortText({
18
- displayName: 'Phone Number',
19
- description: 'Registered phone number in international format',
20
- required: true,
21
- }),
22
- discoverable_by_number: Property.Checkbox({
23
- displayName: 'Discoverable by Number',
24
- description: 'Allow others to discover you by phone number',
25
- required: false,
26
- }),
27
- share_number: Property.Checkbox({
28
- displayName: 'Share Number',
29
- description: 'Share your phone number with contacts',
30
- required: false,
31
- }),
32
- },
33
- async run(context) {
34
- const { number, discoverable_by_number, share_number } = context.propsValue;
35
- // Auth props are passed directly to API client
36
-
37
- const apiClient = new SignalCliApiClient(context.auth.props);
38
- const formattedNumber = formatPhoneNumber(number);
39
-
40
- const requestBody: UpdateAccountSettingsRequest = {};
41
-
42
- if (discoverable_by_number !== undefined) {
43
- requestBody.discoverable_by_number = discoverable_by_number;
44
- }
45
-
46
- if (share_number !== undefined) {
47
- requestBody.share_number = share_number;
48
- }
49
-
50
- await apiClient.put(
51
- `/v1/accounts/${encodeURIComponent(formattedNumber)}/settings`,
52
- requestBody
53
- );
54
-
55
- return { success: true };
56
- },
57
- });
@@ -1,65 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { signalCliRestApiAuth } from '../common/auth';
3
- import { SignalCliApiClient } from '../common/api-client';
4
- import { formatPhoneNumber } from '../common/utils';
5
-
6
- interface UpdateContactRequest {
7
- recipient: string;
8
- name?: string;
9
- expiration_in_seconds?: number;
10
- }
11
-
12
- export const updateContact = createAction({
13
- auth: signalCliRestApiAuth,
14
- name: 'updateContact',
15
- displayName: 'Update Contact',
16
- description: 'Update or add a contact',
17
- props: {
18
- number: Property.ShortText({
19
- displayName: 'Phone Number',
20
- description: 'Registered phone number in international format',
21
- required: true,
22
- }),
23
- recipient: Property.ShortText({
24
- displayName: 'Recipient',
25
- description: 'Phone number of the contact',
26
- required: true,
27
- }),
28
- name: Property.ShortText({
29
- displayName: 'Name',
30
- description: 'Name of the contact',
31
- required: false,
32
- }),
33
- expiration_in_seconds: Property.Number({
34
- displayName: 'Expiration Time',
35
- description: 'Message expiration time in seconds',
36
- required: false,
37
- }),
38
- },
39
- async run(context) {
40
- const { number, recipient, name, expiration_in_seconds } = context.propsValue;
41
- // Auth props are passed directly to API client
42
-
43
- const apiClient = new SignalCliApiClient(context.auth.props);
44
- const formattedNumber = formatPhoneNumber(number);
45
-
46
- const requestBody: UpdateContactRequest = {
47
- recipient,
48
- };
49
-
50
- if (name) {
51
- requestBody.name = name;
52
- }
53
-
54
- if (expiration_in_seconds) {
55
- requestBody.expiration_in_seconds = expiration_in_seconds;
56
- }
57
-
58
- await apiClient.put(
59
- `/v1/contacts/${encodeURIComponent(formattedNumber)}`,
60
- requestBody
61
- );
62
-
63
- return { success: true };
64
- },
65
- });