@webzzconnect/n8n-nodes-webzzconnect 0.4.0 → 0.5.0

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 (23) hide show
  1. package/README.md +53 -12
  2. package/dist/credentials/WebzzConnectApi.credentials.js +7 -1
  3. package/dist/credentials/WebzzConnectApi.credentials.js.map +1 -1
  4. package/dist/credentials/WebzzConnectOAuth2Api.credentials.js +6 -0
  5. package/dist/credentials/WebzzConnectOAuth2Api.credentials.js.map +1 -1
  6. package/dist/nodes/WebzzConnect/GenericFunctions.d.ts +11 -0
  7. package/dist/nodes/WebzzConnect/GenericFunctions.js +56 -14
  8. package/dist/nodes/WebzzConnect/GenericFunctions.js.map +1 -1
  9. package/dist/nodes/WebzzConnect/WebzzConnect.node.js +105 -49
  10. package/dist/nodes/WebzzConnect/WebzzConnect.node.js.map +1 -1
  11. package/dist/nodes/WebzzConnect/descriptions/ConnectionDescription.d.ts +2 -0
  12. package/dist/nodes/WebzzConnect/descriptions/ConnectionDescription.js +22 -0
  13. package/dist/nodes/WebzzConnect/descriptions/ConnectionDescription.js.map +1 -0
  14. package/dist/nodes/WebzzConnect/descriptions/ConversationDescription.d.ts +1 -0
  15. package/dist/nodes/WebzzConnect/descriptions/ConversationDescription.js +47 -9
  16. package/dist/nodes/WebzzConnect/descriptions/ConversationDescription.js.map +1 -1
  17. package/dist/nodes/WebzzConnect/descriptions/WhatsAppTemplateDescription.js +14 -0
  18. package/dist/nodes/WebzzConnect/descriptions/WhatsAppTemplateDescription.js.map +1 -1
  19. package/dist/nodes/WebzzConnectTrigger/WebzzConnectTrigger.node.js +44 -13
  20. package/dist/nodes/WebzzConnectTrigger/WebzzConnectTrigger.node.js.map +1 -1
  21. package/dist/package.json +1 -1
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/package.json +1 -1
package/README.md CHANGED
@@ -23,11 +23,29 @@ The package ships two credentials. Both nodes have an **Authentication** selecto
23
23
 
24
24
  Create a **WebzzConnect OAuth2 API** credential and click **Connect my account**. It is a public PKCE (S256) client with the client id built in, so there is nothing to paste. Sign in to WebzzConnect if asked and approve the permissions: `contacts:edit`, `deals:edit`, `conversations:reply`, `conversations:assign` and `conversations:resolve` (each edit scope includes the matching read access). The account is taken from the token. If you untick a permission, the matching actions fail with a clear "insufficient scope" message.
25
25
 
26
- **Chatbot flows**
26
+ **Connect as a virtual agent**
27
27
 
28
- Use an API key: messages sent with it arrive with `sender` null and `additional_attributes.sender_name` = the key's name ("Sent by <key name>"), so they never match the human-reply rule. Messages sent through OAuth show the connected user as sender.
28
+ Create the key in WebzzConnect → Settings → API keys. To answer customers as a bot, make the key act as a virtual agent (admins only): its role then decides what it can do, and this connection sees only the conversations that agent handles. For reminders, CRM sync and other account-wide flows, use a key that doesn't act as a virtual agent and tick the scopes it needs.
29
29
 
30
- A human replied when `message_type` is outgoing, `private` is false, `content_attributes.automation_rule_id` is empty, and `sender.type` is "user" or `content_attributes.external_echo` is true (a reply from the WhatsApp Business app). WhatsApp campaign and scheduled template sends arrive with `message_type` "template", so they never match.
30
+ To answer customers as a bot, choose Connect as → A virtual agent on the consent screen (admins only, one account). Choose Me to act as yourself.
31
+
32
+ Add a trigger on the same connection: it keeps the agent listening. With a virtual agent connection, keep this workflow active: it is what keeps the agent listening. While it is off, new conversations go to your team, and each conversation the agent holds goes to your team when the customer writes next. To stop the bot, pause the virtual agent in WebzzConnect. Deactivate the workflow before you switch its credential. If a credential was revoked while the workflow was active, deactivation still completes and writes "Couldn't remove WebzzConnect webhook subscription {id}: the credential is no longer valid. It may keep sending events to this URL until it's removed in WebzzConnect → Settings → App webhooks." to the n8n log; delete the leftover in WebzzConnect → Settings → App webhooks.
33
+
34
+ Replacing a connection: switching a trigger's credential, even to another credential of the same account, leaves the old subscription delivering to the old address until it is deleted. A leftover row of a virtual agent keeps that agent listening. Replacing an all-inboxes key with a one-inbox key makes activation fail with a 422 until the old row is gone. The remedy is the same: an administrator deletes the subscription in WebzzConnect → Settings → App webhooks.
35
+
36
+ Two agents' flows can hand a conversation back and forth (A hands to B, B hands back to A). Nothing stops that for you: your flow logic must prevent it, for example by recording a hand-off in a custom attribute and not handing the same conversation back.
37
+
38
+ A conversation the bot holds and the customer leaves quiet gets a nudge after 5 minutes and closes 10 minutes later (auto-closed).
39
+
40
+ Use **Connection → Get Info** to see who a credential acts as (`kind`, account, virtual agent, person). It works while the agent is paused.
41
+
42
+ **Hand off to a person or another agent**
43
+
44
+ Use Assign (a person or a virtual agent) or Unassign (your team), with a hand-off note. The person is notified and reads the note in the conversation; the customer sees nothing. Labels don't move a conversation: keep them for tagging. A virtual agent hands off to one target: pick a team or an agent, not both.
45
+
46
+ **Flows on an account key**
47
+
48
+ A person replied when `message_type` is outgoing, `private` is false, `content_attributes.automation_rule_id` is empty, and `sender.type` is "user" or `content_attributes.external_echo` is true (a reply from the WhatsApp Business app). WhatsApp campaign and scheduled template sends arrive with `message_type` "template", so they never match. An account key's messages arrive with `sender` null.
31
49
 
32
50
  `button_payload` is customer input: compare it with Equals in a Switch node and keep a fallback; never use it in a Code node, a URL or an ID field.
33
51
 
@@ -50,15 +68,18 @@ Both credentials also work with n8n's HTTP Request node (**Predefined Credential
50
68
  - Search (query, contact, pipeline, stage, owner, status)
51
69
 
52
70
  **Conversation**
53
- - Create (with an optional first message)
71
+ - Create (with an optional first message and an optional Status). With a virtual agent connection, a new conversation is handled by that agent, so the customer's reply comes to your flow. A virtual agent can send only into conversations it handles: for reminders and broadcasts, use an account key or an "as me" connection.
54
72
  - Send Message (reply, or add a private note; optionally attach a file by public URL, with the text as a caption). **Message Type** also offers WhatsApp interactive messages: **Reply Buttons** (up to 3), **List** (up to 10 rows with optional descriptions and sections, and a menu label) and **Link Button** (one button that opens a URL), each with an optional header (text, or image / video / document by URL; a list only takes text) and footer. The message text is the body and is required. Each button or row has an ID (the title if left empty) that comes back as `button_payload` when the contact taps it. Interactive messages need a WhatsApp Cloud inbox and the 24-hour window; WebzzConnect checks WhatsApp's limits and answers with a clear message.
55
73
  - Set Custom Attributes (key / value pairs, merged into the conversation's existing attributes; needs the conversations view and resolve permissions)
56
74
  - Add Labels (comma-separated, sent in lowercase, added to the conversation's existing labels; needs the conversations view and reply permissions)
57
75
  - Get
58
- - Get Many (by status and inbox)
59
- - Assign (an agent and/or a team; the agent must be a member of the conversation's inbox, and the node fails if the assignment was not applied)
60
- - Unassign (agent, team, or both)
61
- - Update Status (Open, Resolved or Snoozed with an optional Snooze Until). Resolved sends the CSAT survey when the inbox has CSAT on. Open through an agent's OAuth connection assigns the conversation to that agent; API keys do not.
76
+ - Get Many (by status, inbox and virtual agent; statuses include With a Virtual Agent, Waiting on Customer and Pending (Both). With a virtual agent connection, Open finds none)
77
+ - Assign (a person or a virtual agent in the conversation's inbox, and/or a team, with an optional hand-off note; an unknown or unavailable one is refused and nothing changes)
78
+ - Unassign (agent, team, or both, with an optional hand-off note)
79
+ - Update Status (Open, Resolved, Snoozed with an optional Snooze Until, or Waiting on Customer). Resolved sends the CSAT survey when the inbox has CSAT on. Open through an "as me" connection of an agent-role user also assigns the conversation to that user.
80
+
81
+ **Connection**
82
+ - Get Info (who this credential acts as)
62
83
 
63
84
  **WhatsApp Template**
64
85
  - Send: choose a WhatsApp inbox, a contact and an approved template, then fill the fields that appear for the template: header text or media URL, body variables (numbered or named), URL button variables and the copy-code coupon. If the template is set by an expression, fill **Body Variables** in order instead. The message is created in the contact's open conversation, or in a new one.
@@ -73,20 +94,40 @@ List-style operations have **Return All** and **Limit**. Fields that WebzzConnec
73
94
  **WebzzConnect Trigger** starts a workflow instantly (no polling). Choose one or more events:
74
95
 
75
96
  - New Conversation, Conversation Status Changed, Conversation Updated
76
- - New Message (filter by incoming or outgoing). The output has a top-level `button_payload`: the ID of the tapped reply button or list row, the text (or payload) of a template quick reply, or `null` for typed text, so a Switch node can branch on `{{$json.button_payload}}`.
97
+ - Conversation Handed Off: a virtual agent handed a conversation to a person, another virtual agent or the team. The output has `handoff.from`, `handoff.to` (type agent, person or team; no ID or name for the team), `handoff.note` and `handoff.waiting_message`, each possibly null. It is sent at least once: skip a repeat with the same waiting message ID, when there is one.
98
+ - New Message (filter by direction; new triggers default to Incoming, which keeps a reply bot from answering its own messages and their status updates). The output has a top-level `button_payload`: the ID of the tapped reply button or list row, the text (or payload) of a template quick reply, or `null` for typed text, so a Switch node can branch on `{{$json.button_payload}}`.
77
99
  - Contact Created, Contact Updated
78
100
  - Deal Created, Deal Updated, Deal Stage Changed, Deal Won, Deal Lost, Deal Deleted
79
101
 
80
102
  Optionally narrow conversation and message events to some inboxes, and deal events to some pipelines. Leave a picker empty to receive events from all of them. To change the events or the pickers, deactivate and activate the workflow again.
81
103
 
82
- Activating the workflow registers the n8n webhook address in WebzzConnect; deactivating removes it. If the n8n webhook address changes (for example a new host), the next activation replaces the old registration. Every delivery is checked against its HMAC-SHA256 signature (`X-WebzzConnect-Signature`) and rejected if it is older than five minutes. Your n8n webhook address must be reachable from the internet (set `WEBHOOK_URL` for self-hosted n8n).
104
+ Activating the workflow registers the n8n webhook address in WebzzConnect; deactivating removes it. If the same address is already registered, its secret is rotated (the registration stays). If the n8n webhook address changes (for example a new host), the next activation replaces the old registration. Every delivery is checked against its HMAC-SHA256 signature (`X-WebzzConnect-Signature`) and rejected if it is older than five minutes. Your n8n webhook address must be reachable from the internet (set `WEBHOOK_URL` for self-hosted n8n).
105
+
106
+ The connected person or virtual agent needs access to the data behind each event, otherwise activation fails with a message naming the missing permission.
83
107
 
84
- The connected user needs access to the data behind each event, otherwise activation fails with a message naming the missing permission.
108
+ ## Errors you may see
109
+
110
+ | Code | What it means | What to do |
111
+ |---|---|---|
112
+ | `[409] not_handling` | This virtual agent isn't handling this conversation any more: a person took it, it was handed off, or it's resolved. | Stop the flow for this conversation. |
113
+ | `[403] agent_paused` | The virtual agent is paused, so this connection can't act. | Set the agent live in WebzzConnect, then run again. |
114
+ | `[403]` other | This connection isn't allowed to do this. For a virtual agent its role decides; for an API key, its scopes and inboxes; for OAuth, what was approved at consent. | Check the server message in brackets. |
115
+ | `[422] assignee_not_available` | That person or virtual agent is unknown, removed, or not in the conversation's inbox. | Nothing was changed; pick another. |
116
+ | `[422] conversation_resolved` | A virtual agent can't be assigned to a resolved conversation. | Reopen it first, or assign a person. |
117
+ | `[422] handoff_note_not_allowed` | Only the virtual agent handling the conversation can add a hand-off note, and only when it hands the conversation to someone. | Remove the note, or use a virtual agent connection. |
118
+ | `[422] handoff_note_invalid` | The hand-off note must be 1 to 500 characters. | Shorten it. |
119
+ | `handoff_one_target` | A virtual agent hands off to one target. | Choose an agent or a team, not both. |
120
+ | `assign_no_target` | No person or virtual agent was chosen (or the ID was 0). | Pick one, or use Unassign. |
121
+ | `[422]` on a contact | The contact may exist but this virtual agent sees only the contacts of conversations it handles. | Use an account key or an "as me" connection. |
85
122
 
86
123
  ## Rate limits
87
124
 
88
125
  WebzzConnect allows 600 requests per minute per connection, and contact search is limited to 100 requests per minute per account. When a limit is hit the node fails with a rate-limit error that includes the `Retry-After` wait. Use **Retry On Fail** on the node, or a Wait node, in high-volume workflows.
89
126
 
127
+ ## Example workflows
128
+
129
+ - [WhatsApp sales chatbot with hand-off](examples/whatsapp-sales-flow.json): a menu of reply buttons, a pricing link button, a demo-slot list, and a hand-off to your team with a note. It answers only conversations its virtual agent holds (it checks Connection → Get Info), and a button tapped at the wrong step does nothing. To use it, copy the file's contents and paste them into the n8n editor, or use **Import from URL** with the file's raw GitHub link. Setup steps are in the sticky note inside the workflow.
130
+
90
131
  ## Compatibility
91
132
 
92
133
  Tested with n8n 1.x and 2.x (Node.js 22). Requires a WebzzConnect account.
@@ -98,4 +139,4 @@ Tested with n8n 1.x and 2.x (Node.js 22). Requires a WebzzConnect account.
98
139
 
99
140
  ## Version history
100
141
 
101
- - 0.1.0: first release.
142
+ See [CHANGELOG.md](CHANGELOG.md).
@@ -12,11 +12,17 @@ class WebzzConnectApi {
12
12
  this.documentationUrl = 'https://api-connect.webzz.cloud';
13
13
  this.properties = [
14
14
  {
15
- displayName: 'Use on self-hosted n8n. Create the key in WebzzConnect > Settings > API keys (admins).',
15
+ displayName: 'Use on self-hosted n8n.',
16
16
  name: 'notice',
17
17
  type: 'notice',
18
18
  default: '',
19
19
  },
20
+ {
21
+ displayName: 'Create the key in WebzzConnect → Settings → API keys. To answer customers as a bot, make the key act as a virtual agent (admins only): its role then decides what it can do, and this connection sees only the conversations that agent handles. For reminders, CRM sync and other account-wide flows, use a key that doesn\'t act as a virtual agent and tick the scopes it needs.',
22
+ name: 'agentNotice',
23
+ type: 'notice',
24
+ default: '',
25
+ },
20
26
  {
21
27
  displayName: 'API Key',
22
28
  name: 'apiKey',
@@ -1 +1 @@
1
- {"version":3,"file":"WebzzConnectApi.credentials.js","sourceRoot":"","sources":["../../credentials/WebzzConnectApi.credentials.ts"],"names":[],"mappings":";;;AAYA,MAAa,eAAe;IAA5B;QACC,SAAI,GAAG,iBAAiB,CAAC;QAEzB,gBAAW,GAAG,kBAAkB,CAAC;QAEjC,SAAI,GAAS;YACZ,KAAK,EAAE,6CAA6C;YACpD,IAAI,EAAE,kDAAkD;SACxD,CAAC;QAEF,qBAAgB,GAAG,iCAAiC,CAAC;QAErD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EACV,wFAAwF;gBACzF,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,6BAA6B;gBACtC,GAAG,EAAE,oBAAoB;aACzB;SACD,CAAC;IACH,CAAC;CAAA;AA7CD,0CA6CC"}
1
+ {"version":3,"file":"WebzzConnectApi.credentials.js","sourceRoot":"","sources":["../../credentials/WebzzConnectApi.credentials.ts"],"names":[],"mappings":";;;AAYA,MAAa,eAAe;IAA5B;QACC,SAAI,GAAG,iBAAiB,CAAC;QAEzB,gBAAW,GAAG,kBAAkB,CAAC;QAEjC,SAAI,GAAS;YACZ,KAAK,EAAE,6CAA6C;YACpD,IAAI,EAAE,kDAAkD;SACxD,CAAC;QAEF,qBAAgB,GAAG,iCAAiC,CAAC;QAErD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EACV,yBAAyB;gBAC1B,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EACV,qXAAqX;gBACtX,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,6BAA6B;gBACtC,GAAG,EAAE,oBAAoB;aACzB;SACD,CAAC;IACH,CAAC;CAAA;AApDD,0CAoDC"}
@@ -18,6 +18,12 @@ class WebzzConnectOAuth2Api {
18
18
  type: 'notice',
19
19
  default: '',
20
20
  },
21
+ {
22
+ displayName: 'To answer customers as a bot, choose Connect as → A virtual agent on the consent screen (admins only, one account). Choose Me to act as yourself.',
23
+ name: 'agentNotice',
24
+ type: 'notice',
25
+ default: '',
26
+ },
21
27
  {
22
28
  displayName: 'Grant Type',
23
29
  name: 'grantType',
@@ -1 +1 @@
1
- {"version":3,"file":"WebzzConnectOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/WebzzConnectOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAUA,MAAa,qBAAqB;IAAlC;QACC,SAAI,GAAG,uBAAuB,CAAC;QAE/B,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,gBAAW,GAAG,yBAAyB,CAAC;QAExC,SAAI,GAAS;YACZ,KAAK,EAAE,6CAA6C;YACpD,IAAI,EAAE,kDAAkD;SACxD,CAAC;QAEF,qBAAgB,GAAG,iCAAiC,CAAC;QAErD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,0DAA0D;gBACvE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;aACf;YACD;gBACC,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,6CAA6C;gBACtD,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,yCAAyC;gBAClD,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,6CAA6C;aACtD;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,yFAAyF;aAClG;YACD;gBACC,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;aACf;SACD,CAAC;IACH,CAAC;CAAA;AAzED,sDAyEC"}
1
+ {"version":3,"file":"WebzzConnectOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/WebzzConnectOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAUA,MAAa,qBAAqB;IAAlC;QACC,SAAI,GAAG,uBAAuB,CAAC;QAE/B,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,gBAAW,GAAG,yBAAyB,CAAC;QAExC,SAAI,GAAS;YACZ,KAAK,EAAE,6CAA6C;YACpD,IAAI,EAAE,kDAAkD;SACxD,CAAC;QAEF,qBAAgB,GAAG,iCAAiC,CAAC;QAErD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,0DAA0D;gBACvE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EACV,mJAAmJ;gBACpJ,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;aACf;YACD;gBACC,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,6CAA6C;gBACtD,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,yCAAyC;gBAClD,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,6CAA6C;aACtD;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,yFAAyF;aAClG;YACD;gBACC,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;aACf;SACD,CAAC;IACH,CAAC;CAAA;AAhFD,sDAgFC"}
@@ -4,6 +4,12 @@ export declare const BASE_URL = "https://connect.webzz.cloud";
4
4
  export declare const API_KEY_CREDENTIAL = "webzzConnectApi";
5
5
  export declare const PKCE_CREDENTIAL = "webzzConnectOAuth2Api";
6
6
  export declare const authenticationProperty: INodeProperties;
7
+ export declare const COPY: {
8
+ handoffOneTarget: string;
9
+ connectionKindUnknown: string;
10
+ assignNoTarget: string;
11
+ contactNotVisible: string;
12
+ };
7
13
  export type WzContext = IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions;
8
14
  interface RequestOptions {
9
15
  qs?: IDataObject;
@@ -20,7 +26,12 @@ export declare function digitsOnly(value: string): string;
20
26
  export declare function stripInternalKeys<T>(value: T): T;
21
27
  export declare function getCredentialName(this: WzContext): string;
22
28
  export declare function getAccountId(this: WzContext): Promise<string>;
29
+ export declare function getConnectionInfo(this: WzContext): Promise<IDataObject>;
23
30
  export declare function pathId(this: WzContext, value: unknown): string;
31
+ export declare function parseAssignee(this: WzContext, value: unknown): {
32
+ id: string;
33
+ type: 'User' | 'AgentBot';
34
+ } | undefined;
24
35
  export declare function wzRawRequest(this: WzContext, method: IHttpRequestMethods, path: string, options?: RequestOptions): Promise<unknown>;
25
36
  export declare function readErrorInfo(error: unknown): ErrorInfo;
26
37
  export declare function handleApiError(this: WzContext, error: unknown): never;
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.authenticationProperty = exports.PKCE_CREDENTIAL = exports.API_KEY_CREDENTIAL = exports.BASE_URL = void 0;
3
+ exports.COPY = exports.authenticationProperty = exports.PKCE_CREDENTIAL = exports.API_KEY_CREDENTIAL = exports.BASE_URL = void 0;
4
4
  exports.digitsOnly = digitsOnly;
5
5
  exports.stripInternalKeys = stripInternalKeys;
6
6
  exports.getCredentialName = getCredentialName;
7
7
  exports.getAccountId = getAccountId;
8
+ exports.getConnectionInfo = getConnectionInfo;
8
9
  exports.pathId = pathId;
10
+ exports.parseAssignee = parseAssignee;
9
11
  exports.wzRawRequest = wzRawRequest;
10
12
  exports.readErrorInfo = readErrorInfo;
11
13
  exports.handleApiError = handleApiError;
@@ -30,7 +32,21 @@ exports.authenticationProperty = {
30
32
  { name: 'OAuth2', value: 'oAuth2' },
31
33
  ],
32
34
  default: 'apiKey',
33
- description: 'For a chatbot flow, use an API key: its messages arrive with sender null ("Sent by &lt;key name&gt;"), so they never match the human-reply rule in the trigger\'s New Message description. Messages sent through OAuth show the connected user as sender.',
35
+ description: 'To answer customers as a bot, use a key that acts as a virtual agent, or OAuth with Connect as → A virtual agent. The flow then sees and answers only that agent\'s conversations. For other flows, an account key\'s messages arrive with sender null.',
36
+ };
37
+ exports.COPY = {
38
+ handoffOneTarget: 'A virtual agent hands a conversation to one target: a person, another virtual agent, or your team. Choose an agent or a team, not both. Nothing was changed. (handoff_one_target)',
39
+ connectionKindUnknown: "Couldn't check which kind of connection this is, so nothing was changed. Run again. (connection_kind_unknown)",
40
+ assignNoTarget: 'Choose a person or virtual agent to assign. To remove the assignee, use Unassign. Nothing was changed. (assign_no_target)',
41
+ contactNotVisible: '[422] This contact may already exist, but this virtual agent sees only the contacts of conversations it handles. To create or update contacts across the account, use an account key or an "as me" connection.',
42
+ };
43
+ const ERROR_COPY = {
44
+ '403:agent_paused': '[403] The virtual agent is paused, so this connection can\'t act. Set the agent live in WebzzConnect, then run again. (agent_paused)',
45
+ '409:not_handling': '[409] This virtual agent isn\'t handling this conversation any more: a person took it, it was handed off, or it\'s resolved. Stop the flow for this conversation. (not_handling)',
46
+ '422:assignee_not_available': '[422] That person or virtual agent can\'t take this conversation: unknown, removed, or not in the conversation\'s inbox. Nothing was changed. (assignee_not_available)',
47
+ '422:conversation_resolved': '[422] A virtual agent can\'t be assigned to a resolved conversation. Reopen it first, or assign a person. (conversation_resolved)',
48
+ '422:handoff_note_not_allowed': '[422] Only the virtual agent handling this conversation can add a hand-off note, and only when it hands the conversation to someone. Remove the note, or use a virtual agent connection. Nothing was changed. (handoff_note_not_allowed)',
49
+ '422:handoff_note_invalid': '[422] The hand-off note must be 1 to 500 characters. Nothing was changed. (handoff_note_invalid)',
34
50
  };
35
51
  function digitsOnly(value) {
36
52
  return value.replace(/\D/g, '');
@@ -56,7 +72,7 @@ function getCredentialName() {
56
72
  : this.getNodeParameter('authentication', 'apiKey');
57
73
  return selected === 'oAuth2' ? exports.PKCE_CREDENTIAL : exports.API_KEY_CREDENTIAL;
58
74
  }
59
- const accountIdCache = new WeakMap();
75
+ const tokenInfoCache = new WeakMap();
60
76
  async function sendRequest(method, url, options) {
61
77
  const requestOptions = {
62
78
  method,
@@ -79,17 +95,27 @@ async function getAccountId() {
79
95
  return String(tokenData.account_id);
80
96
  }
81
97
  }
82
- const cached = accountIdCache.get(this);
98
+ const account = (await getTokenInfo.call(this)).account;
99
+ if ((account === null || account === void 0 ? void 0 : account.id) === undefined) {
100
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Could not determine the WebzzConnect account for this credential. Check the API key, or reconnect the OAuth credential.');
101
+ }
102
+ return String(account.id);
103
+ }
104
+ async function getTokenInfo() {
105
+ const cached = tokenInfoCache.get(this);
83
106
  if (cached !== undefined)
84
107
  return cached;
85
108
  const info = (await sendRequest.call(this, 'GET', `${exports.BASE_URL}/api/v1/token_info`, {}));
86
- const account = info.account;
87
- if ((account === null || account === void 0 ? void 0 : account.id) === undefined) {
88
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Could not determine the WebzzConnect account for this credential. Check the API key, or reconnect the OAuth credential.');
109
+ tokenInfoCache.set(this, info);
110
+ return info;
111
+ }
112
+ async function getConnectionInfo() {
113
+ try {
114
+ return await getTokenInfo.call(this);
115
+ }
116
+ catch (error) {
117
+ return handleApiError.call(this, error);
89
118
  }
90
- const accountId = String(account.id);
91
- accountIdCache.set(this, accountId);
92
- return accountId;
93
119
  }
94
120
  function pathId(value) {
95
121
  const id = String(value !== null && value !== void 0 ? value : '').trim();
@@ -98,6 +124,18 @@ function pathId(value) {
98
124
  }
99
125
  return id;
100
126
  }
127
+ function parseAssignee(value) {
128
+ const raw = String(value !== null && value !== void 0 ? value : '').trim();
129
+ if (raw === '')
130
+ return undefined;
131
+ const match = /^(?:(User|AgentBot):)?(\d+)$/.exec(raw);
132
+ if (!match) {
133
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `"${raw}" is not a valid agent (a number, or AgentBot:number)`);
134
+ }
135
+ if (/^0+$/.test(match[2]))
136
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), exports.COPY.assignNoTarget);
137
+ return { id: match[2], type: match[1] === 'AgentBot' ? 'AgentBot' : 'User' };
138
+ }
101
139
  async function wzRawRequest(method, path, options = {}) {
102
140
  if (options.absolute) {
103
141
  return await sendRequest.call(this, method, `${exports.BASE_URL}${path}`, options);
@@ -141,6 +179,7 @@ function readErrorInfo(error) {
141
179
  };
142
180
  }
143
181
  function handleApiError(error) {
182
+ var _a, _b, _c, _d;
144
183
  if (error instanceof n8n_workflow_1.NodeOperationError)
145
184
  throw error;
146
185
  const info = readErrorInfo(error);
@@ -149,16 +188,19 @@ function handleApiError(error) {
149
188
  };
150
189
  if (info.status !== undefined)
151
190
  options.httpCode = String(info.status);
152
- if (info.status === 429) {
191
+ const code = String((_d = (_b = (_a = info.body) === null || _a === void 0 ? void 0 : _a.error_code) !== null && _b !== void 0 ? _b : (_c = info.body) === null || _c === void 0 ? void 0 : _c.error) !== null && _d !== void 0 ? _d : '');
192
+ const copy = ERROR_COPY[`${info.status}:${code}`];
193
+ if (copy) {
194
+ options.message = copy;
195
+ }
196
+ else if (info.status === 429) {
153
197
  options.message = 'WebzzConnect rate limit reached';
154
198
  options.description = info.retryAfter
155
199
  ? `Too many requests. WebzzConnect asks you to retry after ${info.retryAfter} seconds (Retry-After). Add a Wait node or enable "Retry On Fail" for this node.`
156
200
  : 'Too many requests. Wait a moment and retry, or enable "Retry On Fail" for this node. Contact search is limited to 100 requests per minute per account.';
157
201
  }
158
202
  else if (info.status === 403) {
159
- options.message = info.message || 'Forbidden';
160
- options.description =
161
- 'The API key or OAuth consent does not allow this action (insufficient scope or inbox restriction). Check the key\'s permissions in WebzzConnect, or reconnect the OAuth credential and approve all requested permissions.';
203
+ options.message = `[403] This connection isn't allowed to do this. For a virtual agent its role decides; for an API key, its scopes and inboxes; for OAuth, what was approved at consent. (${info.message})`;
162
204
  }
163
205
  else if (info.status === 401) {
164
206
  options.description =
@@ -1 +1 @@
1
- {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources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./descriptions/ContactDescription");
6
6
  const ConversationDescription_1 = require("./descriptions/ConversationDescription");
7
7
  const DealDescription_1 = require("./descriptions/DealDescription");
8
8
  const WhatsAppTemplateDescription_1 = require("./descriptions/WhatsAppTemplateDescription");
9
+ const ConnectionDescription_1 = require("./descriptions/ConnectionDescription");
9
10
  const GenericFunctions_1 = require("./GenericFunctions");
10
11
  function compact(values) {
11
12
  const out = {};
@@ -103,6 +104,9 @@ async function createOrUpdateContact(i) {
103
104
  const retry = await findContact.call(this, email, phone);
104
105
  if (retry)
105
106
  return await update(retry);
107
+ if ((await GenericFunctions_1.getConnectionInfo.call(this)).kind === 'agent') {
108
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), GenericFunctions_1.COPY.contactNotVisible);
109
+ }
106
110
  }
107
111
  return GenericFunctions_1.handleApiError.call(this, error);
108
112
  }
@@ -110,52 +114,87 @@ async function createOrUpdateContact(i) {
110
114
  async function fetchInboxes() {
111
115
  return (0, GenericFunctions_1.asArray)(await GenericFunctions_1.wzApiRequest.call(this, 'GET', '/inboxes'));
112
116
  }
117
+ async function readBack(id) {
118
+ try {
119
+ return (0, GenericFunctions_1.asObject)(await GenericFunctions_1.wzRawRequest.call(this, 'GET', `/conversations/${id}`));
120
+ }
121
+ catch (error) {
122
+ if ((0, GenericFunctions_1.readErrorInfo)(error).status === 404)
123
+ return undefined;
124
+ return GenericFunctions_1.handleApiError.call(this, error);
125
+ }
126
+ }
113
127
  async function assignConversation(i) {
114
- var _a, _b, _c, _d;
128
+ var _a, _b, _c, _d, _e;
115
129
  const id = GenericFunctions_1.pathId.call(this, this.getNodeParameter('conversationId', i));
116
- const agentId = String((_a = this.getNodeParameter('agentId', i, '')) !== null && _a !== void 0 ? _a : '');
117
- const teamId = String((_b = this.getNodeParameter('teamId', i, '')) !== null && _b !== void 0 ? _b : '');
118
- if (!agentId && !teamId) {
119
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Choose an agent, a team, or both', {
120
- itemIndex: i,
121
- });
130
+ const assignee = GenericFunctions_1.parseAssignee.call(this, this.getNodeParameter('agentId', i, ''));
131
+ const teamId = String((_a = this.getNodeParameter('teamId', i, '')) !== null && _a !== void 0 ? _a : '').trim();
132
+ const note = String((_b = this.getNodeParameter('handoffNote', i, '')) !== null && _b !== void 0 ? _b : '');
133
+ if (!assignee && !teamId) {
134
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), GenericFunctions_1.COPY.assignNoTarget, { itemIndex: i });
135
+ }
136
+ if (assignee && teamId) {
137
+ const { kind } = await GenericFunctions_1.getConnectionInfo.call(this);
138
+ if (!kind) {
139
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), GenericFunctions_1.COPY.connectionKindUnknown, { itemIndex: i });
140
+ }
141
+ if (kind === 'agent') {
142
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), GenericFunctions_1.COPY.handoffOneTarget, { itemIndex: i });
143
+ }
122
144
  }
145
+ let team;
123
146
  if (teamId) {
124
- await GenericFunctions_1.wzApiRequest.call(this, 'POST', `/conversations/${id}/assignments`, {
125
- body: { team_id: Number(teamId) },
126
- });
127
- }
128
- if (agentId) {
129
- await GenericFunctions_1.wzApiRequest.call(this, 'POST', `/conversations/${id}/assignments`, {
130
- body: { assignee_id: Number(agentId) },
131
- });
132
- }
133
- const conversation = (0, GenericFunctions_1.asObject)(await GenericFunctions_1.wzApiRequest.call(this, 'GET', `/conversations/${id}`));
134
- const meta = (0, GenericFunctions_1.asObject)(conversation.meta);
135
- if (agentId && String((_c = (0, GenericFunctions_1.asObject)(meta.assignee).id) !== null && _c !== void 0 ? _c : '') !== agentId) {
136
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Agent ${agentId} was not assigned. Check that the agent exists and is a member of the conversation's inbox.`, { itemIndex: i });
137
- }
138
- if (teamId && String((_d = (0, GenericFunctions_1.asObject)(meta.team).id) !== null && _d !== void 0 ? _d : '') !== teamId) {
139
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Team ${teamId} was not assigned. Check that the team exists.`, { itemIndex: i });
147
+ const body = { team_id: Number(GenericFunctions_1.pathId.call(this, teamId)) };
148
+ if (note)
149
+ body.handoff_note = note;
150
+ team = (0, GenericFunctions_1.asObject)(await GenericFunctions_1.wzApiRequest.call(this, 'POST', `/conversations/${id}/assignments`, { body }));
151
+ if (team.id === undefined) {
152
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Team ${teamId} was not assigned. Check that the team exists.`, { itemIndex: i });
153
+ }
140
154
  }
141
- return conversation;
155
+ let assigned = {};
156
+ if (assignee) {
157
+ const body = { assignee_id: assignee.id, assignee_type: assignee.type };
158
+ if (note)
159
+ body.handoff_note = note;
160
+ assigned = (0, GenericFunctions_1.asObject)(await GenericFunctions_1.wzApiRequest.call(this, 'POST', `/conversations/${id}/assignments`, { body }));
161
+ }
162
+ const conversation = await readBack.call(this, id);
163
+ if (conversation)
164
+ return conversation;
165
+ return {
166
+ id: Number(id),
167
+ ...(assignee && {
168
+ assignee: {
169
+ id: Number(assignee.id),
170
+ name: (_d = (_c = assigned.available_name) !== null && _c !== void 0 ? _c : assigned.name) !== null && _d !== void 0 ? _d : null,
171
+ type: assignee.type,
172
+ },
173
+ }),
174
+ ...(team && { team: { id: team.id, name: (_e = team.name) !== null && _e !== void 0 ? _e : null } }),
175
+ };
142
176
  }
143
177
  async function unassignConversation(i) {
178
+ var _a, _b;
144
179
  const id = GenericFunctions_1.pathId.call(this, this.getNodeParameter('conversationId', i));
145
180
  const from = this.getNodeParameter('unassignFrom', i, 'agent');
181
+ const note = String((_a = this.getNodeParameter('handoffNote', i, '')) !== null && _a !== void 0 ? _a : '');
146
182
  if (from === 'team' || from === 'both') {
147
- await GenericFunctions_1.wzApiRequest.call(this, 'POST', `/conversations/${id}/assignments`, {
148
- body: { team_id: null },
149
- });
183
+ const body = { team_id: null };
184
+ if (note && from === 'team')
185
+ body.handoff_note = note;
186
+ await GenericFunctions_1.wzApiRequest.call(this, 'POST', `/conversations/${id}/assignments`, { body });
150
187
  }
151
188
  if (from === 'agent' || from === 'both') {
152
- await GenericFunctions_1.wzApiRequest.call(this, 'POST', `/conversations/${id}/assignments`, {
153
- body: { assignee_id: null },
154
- });
189
+ const body = { assignee_id: null };
190
+ if (note)
191
+ body.handoff_note = note;
192
+ await GenericFunctions_1.wzApiRequest.call(this, 'POST', `/conversations/${id}/assignments`, { body });
155
193
  }
156
- return (0, GenericFunctions_1.asObject)(await GenericFunctions_1.wzApiRequest.call(this, 'GET', `/conversations/${id}`));
194
+ return (_b = (await readBack.call(this, id))) !== null && _b !== void 0 ? _b : { id: Number(id), assignee: null };
157
195
  }
158
196
  async function updateConversationStatus(i) {
197
+ var _a, _b;
159
198
  const id = GenericFunctions_1.pathId.call(this, this.getNodeParameter('conversationId', i));
160
199
  const status = this.getNodeParameter('status', i);
161
200
  const body = { status };
@@ -169,8 +208,11 @@ async function updateConversationStatus(i) {
169
208
  }
170
209
  body.snoozed_until = Math.floor(millis / 1000);
171
210
  }
172
- await GenericFunctions_1.wzApiRequest.call(this, 'POST', `/conversations/${id}/toggle_status`, { body });
173
- return (0, GenericFunctions_1.asObject)(await GenericFunctions_1.wzApiRequest.call(this, 'GET', `/conversations/${id}`));
211
+ const written = (0, GenericFunctions_1.asObject)(await GenericFunctions_1.wzApiRequest.call(this, 'POST', `/conversations/${id}/toggle_status`, { body }));
212
+ return ((_a = (await readBack.call(this, id))) !== null && _a !== void 0 ? _a : {
213
+ id: Number(id),
214
+ status: (_b = (0, GenericFunctions_1.asObject)(written.payload).current_status) !== null && _b !== void 0 ? _b : status,
215
+ });
174
216
  }
175
217
  const HTTP_URL = /^https?:\/\//i;
176
218
  async function uploadByUrl(url, i) {
@@ -439,16 +481,18 @@ async function sendWhatsAppTemplate(i) {
439
481
  const params = processedParams(template, values, processed);
440
482
  if (Object.keys(params).length > 0)
441
483
  templateParams.processed_params = params;
442
- return (0, GenericFunctions_1.asObject)(await GenericFunctions_1.wzApiRequest.call(this, 'POST', '/conversations', {
443
- body: {
444
- inbox_id: inboxId,
445
- contact_id: contactId,
446
- message: {
447
- content: content || template.name,
448
- template_params: templateParams,
449
- },
484
+ const body = {
485
+ inbox_id: inboxId,
486
+ contact_id: contactId,
487
+ message: {
488
+ content: content || template.name,
489
+ template_params: templateParams,
450
490
  },
451
- }));
491
+ };
492
+ const status = this.getNodeParameter('initialStatus', i, '');
493
+ if (status)
494
+ body.status = status;
495
+ return (0, GenericFunctions_1.asObject)(await GenericFunctions_1.wzApiRequest.call(this, 'POST', '/conversations', { body }));
452
496
  }
453
497
  class WebzzConnect {
454
498
  constructor() {
@@ -491,6 +535,7 @@ class WebzzConnect {
491
535
  ],
492
536
  default: 'contact',
493
537
  },
538
+ ...ConnectionDescription_1.connectionOperations,
494
539
  ...ContactDescription_1.contactOperations,
495
540
  ...ContactDescription_1.contactFields,
496
541
  ...DealDescription_1.dealOperations,
@@ -575,14 +620,17 @@ class WebzzConnect {
575
620
  const inboxId = this.getCurrentNodeParameter('inboxId');
576
621
  if (!inboxId)
577
622
  return [];
578
- const path = `/inboxes/${GenericFunctions_1.pathId.call(this, inboxId)}/assignable_agents`;
579
- const agents = (0, GenericFunctions_1.asArray)(await GenericFunctions_1.wzApiRequest.call(this, 'GET', path));
623
+ const agents = (0, GenericFunctions_1.asArray)(await GenericFunctions_1.wzApiRequest.call(this, 'GET', '/assignable_agents', {
624
+ qs: { 'inbox_ids[]': GenericFunctions_1.pathId.call(this, inboxId), include_agent_bots: 1 },
625
+ }));
580
626
  return agents.map((agent) => {
581
627
  var _a, _b;
582
- return ({
583
- name: String((_b = (_a = agent.available_name) !== null && _a !== void 0 ? _a : agent.name) !== null && _b !== void 0 ? _b : agent.email),
584
- value: String(agent.id),
585
- });
628
+ return agent.assignee_type === 'AgentBot'
629
+ ? { name: `${String(agent.name)} (virtual agent)`, value: `AgentBot:${String(agent.id)}` }
630
+ : {
631
+ name: String((_b = (_a = agent.available_name) !== null && _a !== void 0 ? _a : agent.name) !== null && _b !== void 0 ? _b : agent.email),
632
+ value: String(agent.id),
633
+ };
586
634
  });
587
635
  },
588
636
  async getTeams() {
@@ -617,7 +665,11 @@ class WebzzConnect {
617
665
  for (let i = 0; i < items.length; i++) {
618
666
  try {
619
667
  let result = {};
620
- if (resource === 'contact') {
668
+ if (resource === 'connection') {
669
+ const { kind, account, virtual_agent, user } = await GenericFunctions_1.getConnectionInfo.call(this);
670
+ result = { kind, account, virtual_agent, user };
671
+ }
672
+ else if (resource === 'contact') {
621
673
  if (operation === 'create') {
622
674
  const fields = {
623
675
  name: this.getNodeParameter('name', i, ''),
@@ -724,6 +776,9 @@ class WebzzConnect {
724
776
  };
725
777
  if (content)
726
778
  body.message = { content };
779
+ const status = this.getNodeParameter('initialStatus', i, '');
780
+ if (status)
781
+ body.status = status;
727
782
  result = (0, GenericFunctions_1.asObject)(await GenericFunctions_1.wzApiRequest.call(this, 'POST', '/conversations', { body }));
728
783
  }
729
784
  else if (operation === 'sendMessage') {
@@ -756,6 +811,7 @@ class WebzzConnect {
756
811
  qs: compact({
757
812
  status: filters.status || 'open',
758
813
  inbox_id: filters.inboxId,
814
+ agent_id: filters.agentId ? GenericFunctions_1.pathId.call(this, filters.agentId) : undefined,
759
815
  }),
760
816
  returnAll,
761
817
  limit,