
Bulk Upsert Consents API는 여러 연락처의 동의 상태를 한 번에 등록하거나 갱신할 수 있는 기능입니다. 현재는 SMS 채널만 지원하며, Pilot 단계에 있습니다. 즉, Twilio는 현재 초기 사용자들의 피드백을 받고 있으며, 이 기능을 미리 사용해보고 의견을 줄 수 있는 기회가 있다는 뜻입니다.
⚠️ 주의: 이 API는 HIPAA 인증 서비스가 아닙니다. 의료 정보를 다루는 시스템에서는 사용하지 마세요.
consents 객체를 한 요청으로 생성하거나 업데이트 가능correlation_id로 구분되어, 개별 응답 확인 가능correlation_id에 에러 메시지와 함께 응답됨| 항목 | 제한 |
|---|---|
| 요청 수 | 분당 100건 |
| 응답 타임아웃 | 최대 3초 (99%는 1초 이내) |
POST https://accounts.twilio.com/v1/Consents/Bulk
Content-Type: application/x-www-form-urlencoded
items (필수): 연락처의 동의 정보를 담은 객체 배열
contact_id: E.164 포맷의 전화번호 (예: +19999999991)correlation_id: 32자리 UUID 문자열sender_id: 메시징 서비스 SID 또는 전화번호status: opt-in 또는 opt-outsource: website, offline, opt-in-message, opt-out-message, othersdate_of_consent: ISO 8601 날짜 문자열 (선택)const twilio = require("twilio");
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);
async function createBulkConsents() {
const bulkConsent = await client.accounts.v1.bulkConsents.create({
items: [
{
contact_id: "+19999999991",
correlation_id: "ad388b5a46b33b874b0d41f7226db2ef",
sender_id: "MG00000000000000000000000000000000",
date_of_consent: "2025-02-28T10:05:27Z",
status: "opt-in",
source: "website",
},
{
contact_id: "+19",
correlation_id: "02520cfa6c432f0e3ec3a38c122d428d",
sender_id: "12345",
date_of_consent: "2025-02-25T10:05:27Z",
status: "opt-out",
source: "opt-out-message",
},
],
});
console.log(bulkConsent.items);
}
createBulkConsents();
{
"items": [
{
"correlation_id": "ad388b5a46b33b874b0d41f7226db2ef",
"error_code": 0,
"error_messages": []
},
{
"correlation_id": "02520cfa6c432f0e3ec3a38c122d428d",
"error_code": 30646,
"error_messages": [
"INVALID_CONTACT_ID"
]
}
]
}
error_code: 0이면 성공, 그 외에는 실패 코드error_messages: 유효성 검사 실패 시 메시지 포함30646: 잘못된 contact_id, 누락된 필드 등 유효성 검사 실패