Skip to content

Commit

Permalink
📝 Updated INTEGRATIONS.md
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Dec 29, 2023
1 parent 98816e5 commit e00977b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 42 deletions.
50 changes: 13 additions & 37 deletions INTEGRATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export interface IContactService {
): Promise<ApiResponse<OriginalContactOutput>>;

syncContacts(
linkedUserId: string,
linkedUserId: string,
): Promise<ApiResponse<OriginalContactOutput[]>>;
}
```
Expand All @@ -166,10 +166,13 @@ export class My3rdPartyService implements IContactService {
private prisma: PrismaService,
private logger: LoggerService,
private cryptoService: EncryptionService,
private registry: ServiceRegistry,
) {
this.logger.setContext(
CrmObject.contact.toUpperCase() + ':' + My3rdPartyService.name,
);
this.registry.registerService('my3rdPartyService', this);

}
async addContact(
contactData: 3rdPartyContactInput,
Expand Down Expand Up @@ -286,35 +289,7 @@ export const contactUnificationMapping = {
};
```

Don't forget to add your service you've defined at step 1 inside the Registry under `/crm/contact/services/registry.service.ts`.

```ts
@Injectable()
export class ServiceRegistry {
private serviceMap: Map<string, IContactService>;

constructor(
freshsales: FreshSalesService,
hubspot: HubspotService,
zoho: ZohoService,
zendesk: ZendeskService,
pipedrive: PipedriveService,
// ADD YOUR 3RD PARTY HERE
my3rdParty: My3rdPartyService
) {
this.serviceMap = new Map<string, IContactService>();
this.serviceMap.set('freshsales', freshsales);
this.serviceMap.set('hubspot', hubspot);
this.serviceMap.set('zoho', zoho);
this.serviceMap.set('zendesk', zendesk);
this.serviceMap.set('pipedrive', pipedrive);
// ADD YOUR 3RD PARTY HERE
this.serviceMap.set('my3rdParty', my3rdParty);
}
}
```

Finally, add it under the `ContactModule` module !
Don't forget to add your service you've defined at step 1 inside the module under `/crm/contact/contact.module.ts`.

```ts
@Module({
Expand All @@ -327,21 +302,22 @@ Finally, add it under the `ContactModule` module !
providers: [
ContactService,
PrismaService,
FreshSalesService,
ZendeskService,
ZohoService,
PipedriveService,
HubspotService,
LoggerService,
FieldMappingService,
SyncContactsService,
SyncService,
WebhookService,
EncryptionService,
ServiceRegistry,
/* PROVIDERS SERVICES */
FreshSalesService,
ZendeskService,
ZohoService,
PipedriveService,
HubspotService,
//INSERT YOUR SERVICE HERE
My3rdPartyService
],
exports: [SyncContactsService],
exports: [SyncService],
})
export class ContactModule {}

Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/crm/contact/contact.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ServiceRegistry } from './services/registry.service';
WebhookService,
EncryptionService,
ServiceRegistry,
//PROVIDERS SERVICES
/* PROVIDERS SERVICES */
FreshsalesService,
ZendeskService,
ZohoService,
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/ticketing/attachment/attachment.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { BullModule } from '@nestjs/bull';
EncryptionService,
FieldMappingService,
ServiceRegistry,
//PROVIDERS SERVICES
/* PROVIDERS SERVICES */
ZendeskService,
],
exports: [SyncService],
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/ticketing/comment/comment.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ServiceRegistry } from './services/registry.service';
EncryptionService,
FieldMappingService,
ServiceRegistry,
//PROVIDERS SERVICES
/* PROVIDERS SERVICES */
ZendeskService,
],
exports: [SyncService],
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/ticketing/contact/contact.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { ContactController } from './contact.controller';
EncryptionService,
FieldMappingService,
ServiceRegistry,
/* PROVIDERS SERVICES */
ZendeskService,
],
exports: [SyncService],
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/ticketing/ticket/ticket.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ServiceRegistry } from './services/registry.service';
EncryptionService,
FieldMappingService,
ServiceRegistry,
//PROVIDERS SERVICES
/* PROVIDERS SERVICES */
ZendeskService,
],
exports: [SyncService],
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/ticketing/user/user.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { SyncService } from './sync/sync.service';
EncryptionService,
FieldMappingService,
ServiceRegistry,
//PROVIDERS SERVICES
/* PROVIDERS SERVICES */
ZendeskService,
],
exports: [SyncService],
Expand Down

0 comments on commit e00977b

Please sign in to comment.