Skip to content

라이브 활동 시작

post

/messages/live_activity/start

이 엔드포인트를 사용하여 iOS 앱에 표시되는 라이브 활동을 원격으로 시작할 수 있습니다. 이 엔드포인트에는 추가 설정이 필요합니다.

라이브 활동을 만든 후에는 특정 세그먼트에 대해 원격으로 활동을 시작하도록 POST 요청을 할 수 있습니다. Apple의 라이브 활동에 대한 자세한 내용은 ActivityKit 푸시 알림으로 라이브 활동 시작 및 업데이트를 참조하세요.

content-available이 설정되지 않은 경우 기본 Apple 푸시 알림 서비스(APNs) 우선순위는 10입니다. content-available이 설정된 경우 이 우선순위는 5입니다. 자세한 내용은 Apple push object를 참조하세요.

자동 해제 설정

라이브 활동이 시작된 후 자동 해제를 설정하려면 백엔드에서 업데이트 엔드포인트로 후속 요청을 예약하세요.

  1. 나중에 재사용할 수 있는 activity_id와 함께 /messages/live_activity/start 요청을 보냅니다.
  2. 해당 activity_id와 목표 종료 시간을 백엔드 스케줄러에 저장합니다.
  3. 목표 종료 시간에 end_activitytrue로 설정하여 /messages/live_activity/update 요청을 보냅니다.
  4. 동일한 업데이트 요청에서 해제 동작을 구성합니다. 자세한 내용은 /messages/live_activity/update 엔드포인트를 참조하세요.
  5. 메시지 활동 로그에서 전송 및 결과 이벤트를 확인합니다.

필수 조건

이 엔드포인트를 사용하려면 다음을 완료해야 합니다:

사용량 제한

이 엔드포인트에는 API 사용량 제한 설명서에 명시된 대로 기본 Braze 사용량 제한인 시간당 250,000건의 요청이 적용됩니다.

요청 본문

1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "app_id": "(required, string) App API identifier retrieved from the Developer Console.",
  "activity_id": "(required, string) Define a custom string as your `activity_id`. You will use this ID when you wish to send update or end events to your Live Activity.",
  "activity_attributes_type": "(required, string) The activity attributes type you define within `liveActivities.registerPushToStart` in your app",
  "activity_attributes": "(required, object) The static attribute values for the activity type (such as the sports team names, which don't change)",
  "content_state": "(required, object) You define the ContentState parameters when you create your Live Activity. Pass the updated values for your ContentState using this object. The format of this request must match the shape you initially defined.",
  "stale_date": "(optional, datetime in ISO-8601 format) The time the Live Activity content is marked as outdated in the user’s UI.",
  "notification": "(required, object) Include an `apple_push` object to define a push notification that creates an alert for the user, displayed on paired watchOS devices. Should include `notification.alert.title` and `notification.alert.body`",
  // One of the following:
  "external_user_ids": "(optional, array of strings) see external user identifier, maximum 50",
  "custom_audience": "(optional, connected audience object) see connected audience",
  "segment_id": "(optional, string) see segment identifier"
}

요청 매개변수

예시 요청

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
curl --location --request POST 'https://rest.iad-01.braze.com/messages/live_activity/start' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR-REST-API-KEY}' \
--data-raw '{
    "app_id": "{YOUR-APP-API-IDENTIFIER}",
    "activity_id": "football-chiefs-bills-2024-01-21",
    "content_state": {
        "teamOneScore": 0,
        "teamTwoScore": 0
    },
    "activity_attributes_type": "FootballActivity",
    "activity_attributes": {
        "team1Name": "Chiefs",
        "team2Name": "Bills"
    },
    "stale_date": "2024-01-22T16:55:49+0000",
    "notification": {
        "alert": {
            "body": "The game is starting! Tune in soon!",
            "title": "Chiefs v. Bills"
        }
    },
    // One of the following required:
    "segment_id": "{YOUR-SEGMENT-API-IDENTIFIER}", // Optional
    "custom_audience": {...}, // Optional
    "external_user_ids": ["user-id1", "user-id2"], // Optional
}'

응답

이 엔드포인트에 대한 상태 코드 응답은 2014XX 두 가지입니다.

성공 응답 예시

요청 형식이 올바르게 지정되어 요청을 수신한 경우 201 상태 코드가 반환됩니다. 201 상태 코드는 다음과 같은 응답 본문을 반환할 수 있습니다.

1
2
3
{
  "message": "success"
}

오류 응답 예시

4XX 상태 코드 클래스는 클라이언트 오류를 나타냅니다. 발생할 수 있는 오류에 대한 자세한 내용은 API 오류 및 응답 문서를 참조하세요.

400 상태 코드는 다음과 같은 응답 본문을 반환할 수 있습니다.

1
2
3
{
    "error": "\nProblem:\n  message body does not match declared format\nResolution:\n  when specifying application/json as content-type, you must pass valid application/json in the request's 'body' "
}
New Stuff!