파일 관리
Brevo CRM Files API를 사용하면 Tajo 플랫폼 내에서 연락처, 회사, 거래에 연결된 첨부 파일을 업로드하고 관리할 수 있습니다.
개요
파일 관리는 다음과 같은 상황에서 꼭 필요합니다.
- 거래 문서화: 제안서, 계약서, 합의서를 보관합니다
- 고객 기록: 인보이스, 영수증, 주고받은 문서를 첨부합니다
- 로열티 프로그램 자료: 프로그램 세부 내용과 혜택 요약을 공유합니다
- 컴플라이언스: 엔터프라이즈 계정의 문서 감사 추적을 유지합니다
- 팀 협업: 영업팀 구성원 간에 자료를 공유합니다
빠른 시작
파일 업로드
POST https://api.brevo.com/v3/crm/filesContent-Type: multipart/form-dataapi-key: YOUR_API_KEY
--boundaryContent-Disposition: form-data; name="file"; filename="enterprise-proposal.pdf"Content-Type: application/pdf
[file content]--boundaryContent-Disposition: form-data; name="dealIds"
deal_abc123def456--boundaryContent-Disposition: form-data; name="companyIds"
comp_123456789--boundaryContent-Disposition: form-data; name="contactIds"
12345--boundary--응답
{ "id": "file_001", "name": "enterprise-proposal.pdf", "size": 245760, "contentType": "application/pdf", "dealIds": ["deal_abc123def456"], "companyIds": ["comp_123456789"], "contactIds": [12345], "created_at": "2026-01-25T14:30:00Z"}파일 조회
전체 파일 목록
GET https://api.brevo.com/v3/crm/files?limit=50&offset=0&sort=descContent-Type: application/jsonapi-key: YOUR_API_KEY응답
{ "items": [ { "id": "file_001", "name": "enterprise-proposal.pdf", "size": 245760, "contentType": "application/pdf", "dealIds": ["deal_abc123def456"], "companyIds": ["comp_123456789"], "created_at": "2026-01-25T14:30:00Z" } ], "total": 1}파일 필터링
GET https://api.brevo.com/v3/crm/files?filters[dealIds]=deal_abc123def456&sort=created_at:desc단일 파일 조회
GET https://api.brevo.com/v3/crm/files/{file_id}Content-Type: application/jsonapi-key: YOUR_API_KEY파일 다운로드
GET https://api.brevo.com/v3/crm/files/{file_id}/dataapi-key: YOUR_API_KEY파일 관리 자동화
거래 문서 워크플로
거래 생애주기 전반에 걸쳐 문서를 자동으로 관리합니다.
class DealDocumentManager { constructor() { this.filesApi = new FilesApi(); }
async attachProposal(dealId, proposalBuffer, companyName) { const fileName = `proposal-${companyName.toLowerCase().replace(/\s+/g, '-')}-${Date.now()}.pdf`;
const file = await this.filesApi.uploadFile({ file: proposalBuffer, fileName: fileName, dealIds: [dealId] });
// Create a note referencing the uploaded proposal await this.notesApi.createNote({ text: `Proposal uploaded: ${fileName}`, dealIds: [dealId] });
return file; }
async attachContract(dealId, contractBuffer, companyId) { const fileName = `contract-${dealId}-${new Date().toISOString().slice(0, 10)}.pdf`;
const file = await this.filesApi.uploadFile({ file: contractBuffer, fileName: fileName, dealIds: [dealId], companyIds: [companyId] });
return file; }
async getDealDocuments(dealId) { const files = await this.filesApi.getFiles({ filters: { dealIds: dealId }, sort: 'created_at:desc' });
return { proposals: files.items.filter(f => f.name.startsWith('proposal-')), contracts: files.items.filter(f => f.name.startsWith('contract-')), other: files.items.filter(f => !f.name.startsWith('proposal-') && !f.name.startsWith('contract-') ), totalSize: files.items.reduce((sum, f) => sum + f.size, 0) }; }}로열티 프로그램 문서
class LoyaltyDocumentManager { async generateAndAttachBenefitsSummary(companyId, tier) { const company = await this.companiesApi.getCompany(companyId);
const summary = await this.generateBenefitsPDF({ companyName: company.name, tier: tier, benefits: this.getTierBenefits(tier), annualSpend: company.attributes.annual_spend, pointsBalance: company.attributes.loyalty_points });
return await this.filesApi.uploadFile({ file: summary, fileName: `loyalty-benefits-${tier.toLowerCase().replace(/\s+/g, '-')}.pdf`, companyIds: [companyId] }); }
async attachTierUpgradeDocuments(companyId, oldTier, newTier) { const documents = [ { name: 'tier-upgrade-confirmation', content: this.generateUpgradeConfirmation(oldTier, newTier) }, { name: 'new-benefits-guide', content: this.generateBenefitsGuide(newTier) } ];
const uploaded = []; for (const doc of documents) { const file = await this.filesApi.uploadFile({ file: doc.content, fileName: `${doc.name}-${Date.now()}.pdf`, companyIds: [companyId] }); uploaded.push(file); }
return uploaded; }}지원 파일 형식
| 분류 | 확장자 | 최대 크기 |
|---|---|---|
| 문서 | .pdf, .doc, .docx, .txt | 10 MB |
| 스프레드시트 | .xls, .xlsx, .csv | 10 MB |
| 이미지 | .png, .jpg, .jpeg, .gif | 5 MB |
| 프레젠테이션 | .ppt, .pptx | 10 MB |
API 메서드 레퍼런스
// Upload a fileconst file = await filesApi.uploadFile({ file: fileBuffer, fileName: 'proposal.pdf', dealIds: ['deal_abc123'], companyIds: ['comp_123']});
// Get file metadataconst file = await filesApi.getFile('file_001');
// Download file dataconst fileData = await filesApi.downloadFile('file_001');
// Delete fileawait filesApi.deleteFile('file_001');
// List files with filteringconst files = await filesApi.getFiles({ filters: { dealIds: 'deal_abc123' }, sort: 'created_at:desc', limit: 50});모범 사례
- 명명 규칙: 쉽게 식별할 수 있도록 날짜를 포함한 설명적인 파일 이름을 사용하십시오
- 레코드 연결: 관련된 모든 거래, 회사, 연락처에 파일을 연결하십시오
- 버전 관리: 파일 이름에 버전 번호나 날짜를 포함하십시오
- 용량 관리: 큰 파일은 업로드 전에 압축하십시오
- 접근 제어: 적절한 접근 권한이 유지되도록 파일 연결을 정기적으로 점검하십시오
- 정리: 오래된 문서를 삭제하여 CRM 레코드를 관리 가능한 상태로 유지하십시오
오류 처리
try { const file = await filesApi.uploadFile(fileData); console.log('File uploaded:', file.id);} catch (error) { if (error.status === 400) { console.error('Invalid file data:', error.message); } else if (error.status === 413) { console.error('File size exceeds maximum limit'); } else if (error.status === 415) { console.error('Unsupported file type'); } else { console.error('Unexpected error:', error); }}