-
Notifications
You must be signed in to change notification settings - Fork 13k
feat: Outbound Comms endpoints #36377
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
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
476a827
feat: adds new endpoints to interact with outbound providers
lucas-a-pelegrino a12b5d4
refactor: moves outbound endpoints to correct place
lucas-a-pelegrino 0b15f6d
refactor: improve business logic for outbound comms
lucas-a-pelegrino ef12314
refactor: adds more minor improvements to listOutboundPRoviders logic
lucas-a-pelegrino e3767f2
tests: adds unit testing for OutboundMessageProviderService
lucas-a-pelegrino 8d16c0b
chore: adds a minor improvement on OutboundMessageProviderService
lucas-a-pelegrino 517c4dd
Merge branch 'develop' into feat/CTZ-182
KevLehman 0facbdc
fix
KevLehman d9e2196
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into feat…
lucas-a-pelegrino 7e0ba9a
fix: merge conflicts
lucas-a-pelegrino 17586cd
chore: adds minor improvements to typing to ensure reusability across…
lucas-a-pelegrino 5e37cc9
fix 2
KevLehman 03e6f77
Create new-mails-rhyme.md
KevLehman 3c4d938
fix: merge conflicts
lucas-a-pelegrino a7c4892
Update apps/meteor/ee/app/livechat-enterprise/server/api/lib/outbound.ts
KevLehman f0a5f34
Merge branch 'feat/CTZ-182' of github.com:RocketChat/Rocket.Chat into…
lucas-a-pelegrino 84edd67
Update apps/meteor/ee/app/livechat-enterprise/server/api/lib/outbound.ts
KevLehman 5721a3f
chore: refactor endpoints definition to meet new pattern
lucas-a-pelegrino d656934
Merge branch 'feat/CTZ-182' of github.com:RocketChat/Rocket.Chat into…
lucas-a-pelegrino e195b37
fix: imports mismatches, ajv typings
lucas-a-pelegrino 6cbd5fd
Merge branch 'develop' into feat/CTZ-182
kodiakhq[bot] 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,7 @@ | ||
| --- | ||
| "@rocket.chat/meteor": minor | ||
| "@rocket.chat/apps-engine": minor | ||
| "@rocket.chat/core-typings": minor | ||
| --- | ||
|
|
||
| Adds new endpoints for outbound communications |
3 changes: 2 additions & 1 deletion
3
.../client/views/omnichannel/contactInfo/tabs/ContactInfoDetails/ContactInfoDetailsGroup.tsx
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
26 changes: 26 additions & 0 deletions
26
apps/meteor/ee/app/livechat-enterprise/server/api/lib/outbound.ts
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,26 @@ | ||
| import type { IOutboundProvider, ValidOutboundProvider } from '@rocket.chat/core-typings'; | ||
| import { ValidOutboundProviderList } from '@rocket.chat/core-typings'; | ||
|
|
||
| import { OutboundMessageProvider } from '../../../../../../server/lib/OutboundMessageProvider'; | ||
|
|
||
| export class OutboundMessageProviderService { | ||
| private readonly provider: OutboundMessageProvider; | ||
|
|
||
| constructor() { | ||
| this.provider = new OutboundMessageProvider(); | ||
| } | ||
|
|
||
| private isProviderValid(type: any): type is ValidOutboundProvider { | ||
| return ValidOutboundProviderList.includes(type); | ||
| } | ||
|
|
||
| public listOutboundProviders(type?: string): IOutboundProvider[] { | ||
| if (type !== undefined && !this.isProviderValid(type)) { | ||
| throw new Error('Invalid type'); | ||
| } | ||
|
|
||
| return this.provider.getOutboundMessageProviders(type); | ||
| } | ||
| } | ||
|
|
||
| export const outboundMessageProvider = new OutboundMessageProviderService(); | ||
49 changes: 49 additions & 0 deletions
49
apps/meteor/ee/app/livechat-enterprise/server/api/outbound.ts
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,49 @@ | ||
| import type { IOutboundProvider } from '@rocket.chat/core-typings'; | ||
| import { ajv } from '@rocket.chat/rest-typings/src/v1/Ajv'; | ||
|
|
||
| import { API } from '../../../../../app/api/server'; | ||
| import { isGETOutboundProviderParams } from '../outboundcomms/rest'; | ||
| import { outboundMessageProvider } from './lib/outbound'; | ||
| import type { ExtractRoutesFromAPI } from '../../../../../app/api/server/ApiClass'; | ||
|
|
||
| const outboundCommsEndpoints = API.v1.get( | ||
| 'omnichannel/outbound/providers', | ||
| { | ||
| response: { | ||
| 200: ajv.compile<{ providers: IOutboundProvider[] }>({ | ||
| providers: { | ||
| type: 'array', | ||
| items: { | ||
| type: 'object', | ||
| properties: { | ||
| providerId: { | ||
| type: 'string', | ||
| }, | ||
| providerName: { | ||
| type: 'string', | ||
| }, | ||
| supportsTemplates: { | ||
| type: 'boolean', | ||
| }, | ||
| providerType: { | ||
| type: 'string', | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }), | ||
| }, | ||
| query: isGETOutboundProviderParams, | ||
| authRequired: true, | ||
| }, | ||
| async function action() { | ||
| const { type } = this.queryParams; | ||
|
|
||
| const providers = outboundMessageProvider.listOutboundProviders(type); | ||
| return API.v1.success({ | ||
| providers, | ||
| }); | ||
| }, | ||
| ); | ||
|
|
||
| export type OutboundCommsEndpoints = ExtractRoutesFromAPI<typeof outboundCommsEndpoints>; |
19 changes: 5 additions & 14 deletions
19
apps/meteor/ee/app/livechat-enterprise/server/outboundcomms/rest.ts
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
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
Empty file.
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
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
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
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.