API 트리거 전송을 사용하여 캠페인 메시지 보내기
이 엔드포인트를 사용하면 API 트리거 배달을 사용하여 지정된 사용자에게 즉각적인 일회성 메시지를 보낼 수 있습니다.
API 트리거 전송을 사용하면 메시지 콘텐츠를 Braze 대시보드 내에 보관하면서 API를 사용하여 메시지 전송 시기와 수신자를 지정할 수 있습니다.
세그먼트를 타겟팅하는 경우 요청 기록이 개발자 콘솔에 저장됩니다. 이 엔드포인트로 메시지를 보내려면 API 트리거 캠페인을 구축할 때 생성한 캠페인 ID가 있어야 합니다.
필수 구성 요소
이 엔드포인트를 사용하려면 campaigns.trigger.send 권한으로 API 키를 생성해야 합니다.
요금 제한
요청에 세그먼트 또는 연결된 오디언스를 지정할 때 이 엔드포인트에 분당 250건의 요청으로 사용량 제한을 적용합니다. 그렇지 않으면 external_id를 지정하는 경우 API 사용량 제한에서 설명한 대로 이 엔드포인트에는 /messages/send, /campaigns/trigger/send 및 /canvas/trigger/send 간에 공유되는 시간당 250,000건의 요청으로 기본 사용량 제한이 적용됩니다.
Braze 엔드포인트는 API 요청 일괄 처리를 지원합니다. 메시징 엔드포인트에 대한 단일 요청은 다음 중 하나에 도달할 수 있습니다.
- 최대 50개의 특정
external_ids, 각각 개별 메시지 매개변수를 가지고 있습니다. - 요청에서 연결된 오디언스 오브젝트로 정의된 모든 크기의 오디언스 세그먼트
요청 본문
1
2
Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
"campaign_id": (required, string) see campaign identifier,
"send_id": (optional, string) see send identifier,
"trigger_properties": (optional, object) personalization key-value pairs that apply to all users in this request,
"broadcast": (optional, boolean) see broadcast -- defaults to false on 8/31/17, must be set to true if "recipients" is omitted,
"audience": (optional, connected audience object) see connected audience,
// Including 'audience' sends to only users in the audience
"recipients": (optional, array; if not provided and broadcast is not set to `false`, message sends to the entire segment targeted by the campaign)
[
{
// Either "external_user_id" or "user_alias" or "email" is required. Requests must specify only one.
"user_alias": (optional, user alias object) user alias of user to receive message,
"external_user_id": (optional, string) external identifier of user to receive message,
"email": (optional, string) email address of user to receive message,
"prioritization": (optional, array) prioritization array; required when using email,
"trigger_properties": (optional, object) personalization key-value pairs that apply to this user (these key-value pairs override any keys that conflict with the parent trigger_properties),
"send_to_existing_only": (optional, boolean) defaults to true, can't be used with user aliases; if set to `false`, an attributes object must also be included,
"attributes": (optional, object) fields in the attributes object create or update an attribute of that name with the given value on the specified user profile before the message is sent and existing values are overwritten
}
],
"attachments": (optional, array) array of JSON objects that define the files you need attached, defined by "file_name" and "url",
[
{
"file_name": (required, string) the name of the file you want to attach to your email, excluding the extension (for example, ".pdf"). Attach files up to 2 MB. This is required if you use "attachments",
"url": (required, string) the corresponding URL of the file you want to attach to your email. The file name's extension is detected automatically from the URL defined, which should return the appropriate "Content-Type" as a response header. This is required if you use "attachments",
}
]
}
요청 매개변수
| 매개변수 | 필수 | 데이터 유형 | 설명 |
|---|---|---|---|
campaign_id |
Required | 문자열 | 캠페인 식별자를 참조하세요. |
send_id |
Optional | 문자열 | 식별자 보내기을 참조하십시오. |
trigger_properties |
선택 사항 | 객체 | 트리거 속성을 참조하십시오. 개인화 키-값 페어는 이 요청의 모든 사용자에게 적용됩니다. |
broadcast |
선택 사항 | 부울 | 전체 세그먼트에 캠페인 또는 캔버스가 타겟팅하는 메시지를 보낼 때 broadcast을(를) true로 설정해야 합니다. 이 매개변수는 기본적으로 false로 설정됩니다 (2017년 8월 31일 기준). broadcast가 true로 설정하면 recipients 목록을 포함할 수 없습니다. 그러나 이 플래그를 실수로 설정하면 예상보다 많은 대상에게 메시지를 보낼 수 있으므로 broadcast: true 을 설정할 때는 주의하세요. |
audience |
선택 사항 | 연결된 오디언스 객체 | 연결된 오디언스을 참조하십시오. |
recipients |
선택 사항 | 배열 | 수신자 객체를 참조하십시오.send_to_existing_only가 false인 경우 속성 객체를 포함해야 합니다.recipients 을 제공하지 않고 broadcast 을 true로 설정하면 캠페인이 타겟팅하는 전체 세그먼트에 메시지가 전송됩니다. email 이 식별자인 경우 수신자 객체에 다음을 포함해야 합니다. prioritization 를 수신자 객체에 포함해야 합니다. |
attachments |
선택 사항 | 배열 | broadcast 이 true로 설정되어 있으면 attachments 목록은 포함할 수 없습니다. |
- 수신자 배열에는 최대 50개의 개체가 포함될 수 있으며, 각 개체에는 단일
external_user_id문자열과trigger_properties개체가 포함됩니다. send_to_existing_only이true(기본값)인 경우 Braze는 기존 사용자에게만 메시지를 보냅니다.false로 설정하고 속성 개체를 제공하면, 사용자가 존재하지 않는 경우 Braze는 새 사용자를 생성합니다.send_to_existing_only을false으로 설정하는 것은 사용자 별칭 지정에 지원되지 않으며, 이 엔드포인트를 통해 새로운 별칭 전용 사용자를 만들 수 없습니다. 사용자 별칭 지정 사용자에게 보내려면 해당 사용자가 이미 Braze에 존재해야 합니다.
사용자의 구독 그룹 상태는 attributes 객체 내에 subscription_groups 매개변수를 포함하여 업데이트할 수 있습니다. 자세한 내용은 사용자 속성 개체를 참조하십시오.
요청 예시
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
curl --location --request POST 'https://rest.iad-01.braze.com/campaigns/trigger/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-REST-API-KEY' \
--data-raw '{
"campaign_id": "campaign_identifier",
"send_id": "send_identifier",
"trigger_properties": "",
"broadcast": false,
"audience": {
"AND": [
{
"custom_attribute": {
"custom_attribute_name": "eye_color",
"comparison": "equals",
"value": "blue"
}
},
{
"custom_attribute": {
"custom_attribute_name": "favorite_foods",
"comparison": "includes_value",
"value": "pizza"
}
},
{
"OR": [
{
"custom_attribute": {
"custom_attribute_name": "last_purchase_time",
"comparison": "less_than_x_days_ago",
"value": 2
}
},
{
"push_subscription_status": {
"comparison": "is",
"value": "opted_in"
}
}
]
},
{
"email_subscription_status": {
"comparison": "is_not",
"value": "subscribed"
}
},
{
"last_used_app": {
"comparison": "after",
"value": "2019-07-22T13:17:55+0000"
}
}
]
},
"recipients": [
{
"user_alias": {
"alias_name" : "example_name",
"alias_label" : "example_label"
},
"external_user_id": "external_user_identifier",
"trigger_properties": "",
"send_to_existing_only": true,
"attributes": {
"first_name" : "Alex"
}
}
],
"attachments": [
{
"file_name" : "YourFileName",
"url" : "https://exampleurl.com/YourFileName.pdf"
}
]
}'
응답 세부 정보
메시지 전송 엔드포인트 응답에는 메시지 발송을 다시 참조할 수 있도록 메시지의 dispatch_id 주소가 포함됩니다. dispatch_id 은 메시지 발송의 ID로, Braze에서 전송되는 각 전송의 고유 ID입니다. 이 엔드포인트를 사용하면 전체 배치된 사용자 집합에 대해 단일 dispatch_id 을 받게 됩니다. 자세한 내용은 dispatch_id 에서 디스패치 ID 동작에 대한 문서를 참조하세요.
요청에 치명적인 오류가 발생하면 오류 코드와 설명은 오류 및 응답을 참조하세요.
캠페인용 속성 개체
Braze에는 API 트리거 캠페인을 보내기 전에 사용자에 대한 속성과 값을 추가, 생성 또는 업데이트할 수 있는 attributes 이라는 메시징 객체가 있습니다. campaign/trigger/send 엔드포인트를 사용하는 이 API 호출은 캠페인을 처리하고 전송하기 전에 사용자 속성 개체를 처리합니다. 이것은 경쟁 조건으로 인해 발생할 수 있는 문제의 위험을 최소화하는 데 도움이 됩니다.
이 엔드포인트의 캔버스 버전을 찾고 있습니까? API 트리거 배달을 사용하여 캔버스 메시지 보내기를 확인하세요.
GitHub 에서 이 페이지를 편집합니다.