skedyul 0.1.21 → 0.1.23

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.
@@ -33,6 +33,41 @@ export declare const workplace: {
33
33
  list(args?: ListArgs): Promise<Workplace[]>;
34
34
  get(id: string): Promise<Workplace>;
35
35
  };
36
+ export interface CreateMessageAttachment {
37
+ fileId: string;
38
+ name: string;
39
+ mimeType: string;
40
+ size: number;
41
+ }
42
+ export interface CreateMessageType {
43
+ id?: string | null;
44
+ remoteId?: string | null;
45
+ message: string;
46
+ title?: string | null;
47
+ contentRaw?: string | null;
48
+ newChat?: boolean;
49
+ attachments?: CreateMessageAttachment[];
50
+ }
51
+ export interface ReceiveMessageContact {
52
+ id?: string;
53
+ identifierValue?: string;
54
+ }
55
+ export interface ReceiveMessageInput {
56
+ /** Communication channel ID */
57
+ communicationChannelId: string;
58
+ /** Sender's identifier (e.g., phone number, email) */
59
+ from: string;
60
+ /** Message payload */
61
+ message: CreateMessageType;
62
+ /** Optional contact metadata to associate the message */
63
+ contact?: ReceiveMessageContact;
64
+ /** Optional remote/external message ID (e.g., Twilio MessageSid) */
65
+ remoteId?: string;
66
+ }
67
+ export interface ReceiveMessageResponse {
68
+ success: boolean;
69
+ messageId?: string;
70
+ }
36
71
  export declare const communicationChannel: {
37
72
  /**
38
73
  * List communication channels with optional filters.
@@ -48,5 +83,23 @@ export declare const communicationChannel: {
48
83
  */
49
84
  list(args?: ListArgs): Promise<CommunicationChannel[]>;
50
85
  get(id: string): Promise<CommunicationChannel | null>;
86
+ /**
87
+ * Receive an inbound message on a communication channel.
88
+ *
89
+ * This is typically called from webhook handlers to process incoming messages
90
+ * (e.g., SMS from Twilio, emails, WhatsApp messages).
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * // In a webhook handler
95
+ * const result = await communicationChannel.receiveMessage({
96
+ * communicationChannelId: channel.id,
97
+ * from: '+1234567890',
98
+ * message: 'Hello!',
99
+ * remoteId: 'twilio-message-sid-123',
100
+ * });
101
+ * ```
102
+ */
103
+ receiveMessage(input: ReceiveMessageInput): Promise<ReceiveMessageResponse>;
51
104
  };
52
105
  export {};
@@ -97,4 +97,31 @@ exports.communicationChannel = {
97
97
  const payload = (await callCore('communicationChannel.get', { id }));
98
98
  return payload.channel;
99
99
  },
100
+ /**
101
+ * Receive an inbound message on a communication channel.
102
+ *
103
+ * This is typically called from webhook handlers to process incoming messages
104
+ * (e.g., SMS from Twilio, emails, WhatsApp messages).
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * // In a webhook handler
109
+ * const result = await communicationChannel.receiveMessage({
110
+ * communicationChannelId: channel.id,
111
+ * from: '+1234567890',
112
+ * message: 'Hello!',
113
+ * remoteId: 'twilio-message-sid-123',
114
+ * });
115
+ * ```
116
+ */
117
+ async receiveMessage(input) {
118
+ const payload = (await callCore('communicationChannel.receiveMessage', {
119
+ communicationChannelId: input.communicationChannelId,
120
+ from: input.from,
121
+ message: input.message,
122
+ contact: input.contact,
123
+ ...(input.remoteId ? { remoteId: input.remoteId } : {}),
124
+ }));
125
+ return payload;
126
+ },
100
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",