-
Notifications
You must be signed in to change notification settings - Fork 5.5k
17425 belco #17580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
17425 belco #17580
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Belco Component | ||
|
|
||
| This component provides integration with the Belco API for managing conversations and customer support. | ||
|
|
||
| ## Sources | ||
|
|
||
| ### New Conversation | ||
| - **Key**: `belco-new-conversation` | ||
| - **Description**: Emits a new conversation event when a new conversation is created. | ||
| - **Documentation**: [Get Conversations API](https://developers.belco.io/reference/get_conversations) | ||
|
|
||
| ## Actions | ||
|
|
||
| ### List All Conversations | ||
| - **Key**: `belco-list-all-conversations` | ||
| - **Description**: Get a list of conversations | ||
| - **Documentation**: [Get Conversations API](https://developers.belco.io/reference/get_conversations) | ||
|
|
||
| ### Create Conversation | ||
| - **Key**: `belco-create-conversation` | ||
| - **Description**: Create a conversation. Required props: shopId, channel and body. Optional props: type, from, to and subject. | ||
| - **Documentation**: [Post Conversations API](https://developers.belco.io/reference/post_conversations) | ||
|
|
||
| ### Send Message | ||
| - **Key**: `belco-send-message` | ||
| - **Description**: Send a message to a conversation. Required props: shopId, channel and body. Optional props: type, from, to and subject. | ||
| - **Documentation**: [Post Conversations Send Message API](https://developers.belco.io/reference/post_conversations-sendmessage) | ||
|
|
||
| ### Retrieve Conversation | ||
| - **Key**: `belco-retrieve-conversation` | ||
| - **Description**: Retrieve a conversation. Required props: conversationId. Optional props: fromDate, toDate, and sortOrder. | ||
| - **Documentation**: [Get Conversations Conversation ID API](https://developers.belco.io/reference/get_conversations-conversationid) | ||
|
|
||
| ### Close Conversation | ||
| - **Key**: `belco-close-conversation` | ||
| - **Description**: Close a conversation. Required props: conversationId. | ||
| - **Documentation**: [Put Conversations Conversation ID Close API](https://developers.belco.io/reference/put_conversations-conversationid-close) | ||
|
|
||
| ### Reopen Conversation | ||
| - **Key**: `belco-reopen-conversation` | ||
| - **Description**: Reopen a conversation. Required props: conversationId. | ||
| - **Documentation**: [Put Conversations Conversation ID Open API](https://developers.belco.io/reference/put_conversations-conversationid-open) | ||
|
|
||
| ### Reply to Conversation | ||
| - **Key**: `belco-reply-to-conversation` | ||
| - **Description**: Reply to a conversation. Required props: conversationId and body. | ||
| - **Documentation**: [Put Conversations Conversation ID Reply API](https://developers.belco.io/reference/put_conversations-conversationid-reply) | ||
|
|
||
| ### Add Note to Conversation | ||
| - **Key**: `belco-add-note-to-conversation` | ||
| - **Description**: Add a note to a conversation. Required props: conversationId and body. | ||
| - **Documentation**: [Put Conversations Conversation ID Add Note API](https://developers.belco.io/reference/put_conversations-conversationid-addnote) | ||
|
|
||
| ## Authentication | ||
|
|
||
| This component uses API key authentication. You'll need to provide your Belco API key in the component configuration. | ||
|
|
||
| ## API Documentation | ||
|
|
||
| For more information about the Belco API, visit: https://developers.belco.io/reference | ||
35 changes: 35 additions & 0 deletions
35
components/belco/actions/add-note-to-conversation/add-note-to-conversation.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import belco from "../../belco.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "belco-add-note-to-conversation", | ||
| name: "Add Note to Conversation", | ||
| description: "Add a note to a conversation specified by ID. [See the documentation](https://developers.belco.io/reference/put_conversations-conversationid-addnote)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| belco, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| belco, | ||
| "conversationId", | ||
| ], | ||
| }, | ||
| body: { | ||
| type: "string", | ||
| label: "Body", | ||
| description: "The note body", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.belco.addNoteToConversation({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| data: { | ||
| body: this.body, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Added note to conversation successfully: ${this.conversationId}`); | ||
| return response; | ||
| }, | ||
| }; |
32 changes: 32 additions & 0 deletions
32
components/belco/actions/close-conversation/close-conversation.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import belco from "../../belco.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "belco-close-conversation", | ||
| name: "Close Conversation", | ||
| description: "Close a conversation specified by ID. [See the documentation](https://developers.belco.io/reference/put_conversations-conversationid-close)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| belco, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| belco, | ||
| "conversationId", | ||
| () => ({ | ||
| excludeStatus: [ | ||
| "closed", | ||
| ], | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.belco.closeConversation({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Closed conversation successfully: ${this.conversationId}`); | ||
| return response; | ||
| }, | ||
| }; |
95 changes: 95 additions & 0 deletions
95
components/belco/actions/create-conversation/create-conversation.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import belco from "../../belco.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "belco-create-conversation", | ||
| name: "Create Conversation", | ||
| description: "Create a conversation from Belco. [See the documentation](https://developers.belco.io/reference/post_conversations)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| belco, | ||
| shopId: { | ||
| propDefinition: [ | ||
| belco, | ||
| "shopId", | ||
| ], | ||
| }, | ||
| channel: { | ||
| propDefinition: [ | ||
| belco, | ||
| "channel", | ||
| ], | ||
| }, | ||
| type: { | ||
| propDefinition: [ | ||
| belco, | ||
| "type", | ||
| ], | ||
| }, | ||
| fromType: { | ||
| propDefinition: [ | ||
| belco, | ||
| "fromType", | ||
| ], | ||
| }, | ||
| from: { | ||
| propDefinition: [ | ||
| belco, | ||
| "from", | ||
| ({ | ||
| fromType, shopId, | ||
| }) => ({ | ||
| fromType, | ||
| shopId, | ||
| }), | ||
| ], | ||
| }, | ||
| to: { | ||
| propDefinition: [ | ||
| belco, | ||
| "to", | ||
| ({ | ||
| toType, shopId, | ||
| }) => ({ | ||
| toType, | ||
| shopId, | ||
| }), | ||
| ], | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| subject: { | ||
| propDefinition: [ | ||
| belco, | ||
| "subject", | ||
| ], | ||
| }, | ||
| body: { | ||
| propDefinition: [ | ||
| belco, | ||
| "body", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.belco.createConversation({ | ||
| $, | ||
| data: { | ||
| shopId: this.shopId, | ||
| channel: this.channel, | ||
| type: this.type, | ||
| from: { | ||
| type: this.fromType, | ||
| _id: this.from, | ||
| }, | ||
| to: { | ||
| type: "contact", | ||
| _id: this.to, | ||
| }, | ||
| subject: this.subject, | ||
| body: this.body, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `New conversation created successfully with ID: ${response._id}`); | ||
| return response; | ||
| }, | ||
| }; | ||
42 changes: 42 additions & 0 deletions
42
components/belco/actions/list-all-conversations/list-all-conversations.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import belco from "../../belco.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "belco-list-all-conversations", | ||
| name: "List All Conversations", | ||
| description: "Get a list of conversations from Belco. [See the documentation](https://developers.belco.io/reference/get_conversations)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| belco, | ||
| limit: { | ||
| type: "integer", | ||
| label: "Limit", | ||
| description: "Maximum number of conversations to retrieve", | ||
| default: 50, | ||
| min: 1, | ||
| max: 100, | ||
| }, | ||
| skip: { | ||
| type: "integer", | ||
| label: "Skip", | ||
| description: "Number of conversations to skip", | ||
| default: 0, | ||
| min: 0, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const params = { | ||
| limit: this.limit, | ||
| skip: this.skip, | ||
| }; | ||
|
|
||
| const response = await this.belco.listConversations({ | ||
| $, | ||
| params, | ||
| }); | ||
|
|
||
| $.export("$summary", `Retrieved ${response.conversations.length} conversations`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; |
32 changes: 32 additions & 0 deletions
32
components/belco/actions/reopen-conversation/reopen-conversation.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import belco from "../../belco.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "belco-reopen-conversation", | ||
| name: "Reopen Conversation", | ||
| description: "Reopen a conversation specified by ID. [See the documentation](https://developers.belco.io/reference/put_conversations-conversationid-open)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| belco, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| belco, | ||
| "conversationId", | ||
| () => ({ | ||
| includeStatus: [ | ||
| "closed", | ||
| ], | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.belco.reopenConversation({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Reopened conversation successfully: ${this.conversationId}`); | ||
| return response; | ||
| }, | ||
| }; |
35 changes: 35 additions & 0 deletions
35
components/belco/actions/reply-to-conversation/reply-to-conversation.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import belco from "../../belco.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "belco-reply-to-conversation", | ||
| name: "Reply to Conversation", | ||
| description: "Reply to a conversation specified by ID. [See the documentation](https://developers.belco.io/reference/put_conversations-conversationid-reply)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| belco, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| belco, | ||
| "conversationId", | ||
| ], | ||
| }, | ||
| body: { | ||
| type: "string", | ||
| label: "Body", | ||
| description: "The reply message body", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.belco.replyToConversation({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| data: { | ||
| body: this.body, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Replied to conversation successfully: ${this.conversationId}`); | ||
| return response; | ||
| }, | ||
| }; |
27 changes: 27 additions & 0 deletions
27
components/belco/actions/retrieve-conversation/retrieve-conversation.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import belco from "../../belco.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "belco-retrieve-conversation", | ||
| name: "Retrieve Conversation", | ||
| description: "Retrieve a conversation specified by ID. [See the documentation](https://developers.belco.io/reference/get_conversations-conversationid)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| belco, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| belco, | ||
| "conversationId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.belco.getConversation({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Retrieved conversation successfully: ${this.conversationId}`); | ||
| return response; | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.