### Webhook Setup and Configuration Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-webhooks-getting-started Guide to setting up a server to receive webhook notifications and configuring webhooks in the App Developer Dashboard. ```APIDOC ## Server Setup Requirements ### Description Your server must be able to accept and process HTTPS requests and have a valid TLS/SSL certificate installed. Self-signed certificates are not supported. ### Method N/A ### Endpoint N/A ## App Developer Dashboard Webhook Setup ### Description Steps to configure webhooks for your application within the App Developer Dashboard, including setting the callback URL, verify token, and subscribing to specific fields. ### Method N/A ### Endpoint N/A ### Parameters #### Request Body - **Callback URL** (string) - Required - The URL of your endpoint to receive webhook notifications. - **Verify Token** (string) - Required - A value used to validate Facebook verification requests. - **Include Values** (boolean) - Optional - Turn on to include the names and new values of changed fields in event notification payloads. ### Response #### Success Response (200) Confirmation of webhook setup and subscription. #### Response Example N/A ``` -------------------------------- ### Install Unity Package from Disk Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/move-unity-getting-started This procedure outlines how to install a Unity package that has been downloaded and unzipped from a local disk. It involves navigating the Unity Package Manager to select the 'package.json' file of the downloaded package. This is suitable for offline installations or when using a specific local build. ```csharp // In Unity Editor: // Window > Package Manager // Packages: In Project dropdown // Click '+' button // Select 'Add package from disk…' // Navigate to and select the 'package.json' file from the unzipped package location // Ensure 'Meta Movement' is listed under 'Packages - Meta Platforms, Inc.' ``` -------------------------------- ### Windows ADB Installation Path Example (Text) Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/unity-env-device-setup Example of a typical installation path for the Android SDK's platform-tools directory on Windows, often used for configuring the system path to enable ADB commands. This path may vary based on the Unity editor version. ```text C:\\Program Files\\Unity\\Hub\\Editor\\\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\platform-tools ``` -------------------------------- ### Install Unity Package from Git URL Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/move-unity-getting-started This code snippet demonstrates how to add a Unity package directly from a Git repository using the Package Manager. It requires the Git URL of the repository and optionally accepts a specific version tag. This method is useful for integrating packages directly from source control. ```csharp // In Unity Editor: // Window > Package Manager // Packages: In Project dropdown // Click '+' button // Select 'Add package from git URL…' // Enter URL: https://github.com/oculus-samples/Unity-Movement.git // Click 'Add' or 'Install' // For a specific version, append '#' to the URL, e.g., https://github.com/oculus-samples/Unity-Movement.git#74.0.0 ``` -------------------------------- ### macOS ADB Installation Path Example (Text) Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/unity-env-device-setup Example of a typical installation path for the Android SDK's platform-tools directory on macOS, often used for configuring the system path to enable ADB commands. This path may vary based on the Unity editor version. ```text /Applications\\/Unity\\/Hub\\/Editor\\//PlaybackEngines\\/AndroidPlayer\\/SDK\\/platform-tools ``` -------------------------------- ### ColocationDriverNetObj: Initialize and Set Up for Colocation Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/unity-shared-spatial-anchors-walkthrough This C# code from ColocationDriverNetObj.cs shows the initialization process for colocation. The Init method finds the OVRCameraRig, gets the logged-in Oculus user, generates a headset GUID, and then awaits the SetupForColocation method. ```csharp // ColocationDriverNetObj.cs 72 private async void Init() 73 { 74 m_ovrCameraRigTransform = FindObjectOfType().transform; 75 m_oculusUser = await OculusPlatformUtils.GetLoggedInUser(); 76 m_headsetGuid = Guid.NewGuid(); 77 await SetupForColocation(); 78 } 79 80 private async UniTask SetupForColocation() 81 { 82 if (HasStateAuthority) 83 { 84 Debug.Log("SetUpAndStartColocation for host"); ``` -------------------------------- ### Async Connection Setup for Host or Client in C# Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/unity-shared-spatial-anchors-walkthrough Handles the asynchronous setup for starting a network connection, differentiating between host and client roles. It loads the scene for hosts, sets up the NetworkRunner, and initiates the connection process. It also registers a callback for colocation completion. ```csharp private async void StartConnectionAsync(bool isHost, GameMode mode = GameMode.Shared) { if (isHost) //if this is a host, create a new room { NetworkModalWindowController.Instance.ShowMessage("Loading Room"); _ = await m_mrSceneLoader.LoadScene(); } SetupForNetworkRunner(); // DiscoverAppController.cs (this file), line 247, instantiate and configures the NetworkRunner NetworkModalWindowController.Instance.ShowMessage("Connecting to Photon..."); ColocationDriverNetObj.OnColocationCompletedCallback += OnColocationReady; ColocationDriverNetObj.SkipColocation = AvatarColocationManager.Instance.IsCurrentPlayerRemote; await Connect(isHost, mode); // DiscoverAppController.cs (this file), line 142 } ``` -------------------------------- ### Subscription Started Event Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-webhooks-getting-started This event is sent when a user begins a subscription, either a new one or a restarted expired subscription. Requires completion of a Data Use Checkup for Subscriptions and User ID. ```APIDOC ## POST /webhooks/subscription_started ### Description Receives notifications when a user starts or restarts a subscription for your application. Data Use Checkup for Subscriptions and User ID is required. ### Method POST ### Endpoint `/webhooks/subscription_started` ### Parameters #### Request Body - **entry** (array) - Required - Contains the subscription event details. - **id** (string) - Required - Unique identifier for the entry. - **time** (integer) - Required - Timestamp of the event. - **changes** (array) - Required - List of changes associated with the event. - **field** (string) - Required - The type of change, e.g., 'subscription_started'. - **value** (object) - Required - Details of the subscription start. - **owner_id** (string) - Required - The ID of the user who owns the subscription. - **source_app** (string) - Required - The source application of the event. - **subscription** (object) - Required - Details of the subscription. - **id** (string) - Required - Unique identifier for the subscription. - **trial_type** (string) - Required - Type of trial, e.g., 'TRIAL_OFFER'. - **sku** (string) - Required - SKU of the subscription product. - **period_start_time** (Unix timestamp) - Required - Start time of the subscription period. - **period_end_time** (Unix timestamp) - Required - End time of the subscription period. - **next_renewal_time** (Unix timestamp) - Required - Time of the next renewal. - **is_active** (boolean) - Required - Indicates if the subscription is active. - **is_trial** (boolean) - Required - Indicates if the subscription is currently in a trial period. - **current_price_term** (object) - Required - Details of the current pricing term. - **term** (string) - Required - Subscription term (e.g., 'MONTHLY'). - **price** (string) - Required - Price of the subscription. - **currency** (string) - Required - Currency of the price. - **next_price_term** (object) - Optional - Details of the next pricing term. - **term** (string) - Required - Subscription term (e.g., 'MONTHLY'). - **price** (string) - Required - Price of the subscription. - **currency** (string) - Required - Currency of the price. - **object** (string) - Required - Type of object, e.g., 'application'. ### Request Example ```json { "entry": [ { "id": "345533925309564", "time": 1715797294, "changes": [ { "field": "subscription_started", "value": { "owner_id": "1234567890", "source_app": "TWILIGHT", "subscription": { "id": "1234567890", "trial_type": "TRIAL_OFFER", "sku": "bronzeTier0", "period_start_time": "1711956272", "period_end_time": "1711956272", "next_renewal_time": "1711956272", "is_active": true, "is_trial": false, "current_price_term": { "term": "MONTHLY", "price": "19.99", "currency": "USD" }, "next_price_term": { "term": "MONTHLY", "price": "1999.00", "currency": "USD" } } } } ] } ], "object": "application" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the webhook reception. #### Response Example ```json { "status": "received" } ``` ``` -------------------------------- ### Track Subscription Started Event (JSON) Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-webhooks-getting-started This event is triggered when a user initiates a subscription for your application, whether it's a new subscription or a reactivation of an expired one. It provides details about the subscription, including its ID, SKU, pricing terms, and active status. ```json { "entry": [ { "id": "345533925309564", "time": 1715797294, "changes": [ { "field": "subscription_started", "value": { "owner_id": "1234567890", "source_app": "TWILIGHT", "subscription": { "id": "1234567890", "trial_type": "TRIAL_OFFER", "sku": "bronzeTier0", "period_start_time": "1711956272", "period_end_time": "1711956272", "next_renewal_time": "1711956272", "is_active": true, "is_trial": false, "current_price_term": { "term": "MONTHLY", "price": "19.99", "currency": "USD" }, "next_price_term": { "term": "MONTHLY", "price": "1999.00", "currency": "USD" } } } } ] } ], "object": "application" } ``` -------------------------------- ### Install and Start App with ADB Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ts-scriptable-testing Installs a specified APK file onto the device and then launches the application using its package name and activity name. This function is useful for deploying and testing applications on the target device. It requires the path to the APK, the package name, and the activity name, along with an optional device ID. ```python def installAndStartApp(apkPath, packageName, activityName, deviceId=None): __runAdbCommand(f"install {apkPath}", deviceId) __runAdbShell(f"am start -S {packageName}/{activityName}", deviceId) ``` -------------------------------- ### Order Status Event Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-webhooks-getting-started This endpoint is triggered when a user completes a purchase or an existing add-on purchase is updated (e.g., consumption, refund, chargeback). It's used to track new and refunded add-on purchases. ```APIDOC ## POST /webhooks/order_status ### Description Receives notifications for add-on purchase events, including new purchases, updates, refunds, and chargebacks. ### Method POST ### Endpoint `/webhooks/order_status` ### Parameters #### Request Body - **entry** (object) - Required - Contains the order event details. - **id** (string) - Required - Unique identifier for the entry. - **time** (integer) - Required - Timestamp of the event. - **changes** (array) - Required - List of changes associated with the event. - **field** (string) - Required - The type of change, e.g., 'order_status'. - **value** (object) - Required - Details of the order status change. - **event_time** (Unix timestamp) - Required - Time the order occurred. - **user_id** (numeric string) - Required - The owner of the add-on. - **product_info** (object) - Required - Object containing order/item details. - **notification_type** (string) - Required - Order event type (e.g., 'PURCHASED', 'REFUNDED', 'CHARGEBACKED'). - **reporting_id** (string) - Required - Unique UUID for the order. - **sku** (string) - Required - Unique SKU of the In-App Purchase item. - **developer_payload** (dict) - Optional - Developer-curated information. ### Request Example ```json { "entry": { "id": "345533925309564", "time": 1718052945, "changes": [ { "field": "order_status", "value": { "event_time": "1659742639", "user_id": "10149999707612630", "product_info": { "notification_type": "PURCHASED", "reporting_id": "03f8833e-9c02-4fa0-978f-4cfe91f86bae", "sku": "item_sku_1", "developer_payload": "{\"quoteId\": 1234567}" } } } ] } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the webhook reception. #### Response Example ```json { "status": "received" } ``` ``` -------------------------------- ### Webhook Notification Structures Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-webhooks-getting-started Details on the structure of base webhook notification requests and specific field event payloads. ```APIDOC ## Base Webhook Notification Request Structure ### Description This is the general structure for a webhook notification request, which may contain one or more field events. ### Method POST ### Endpoint Your configured Callback URL ### Request Body ```json { "entry": [ { "id": "string", "time": number (Unix Timestamp), "changes": Array } ], "object": "application" } ``` ### Response #### Success Response (200) An acknowledgment that the webhook notification was received. #### Response Example ```json { "success": true } ``` ``` ```APIDOC ## Multiplayer Join Intent Event ### Description This event is triggered when a user accepts an in-game invitation or rejoins a multiplayer game session. It provides information to help manage incoming players and server-side logic. ### Method POST ### Endpoint Your configured Callback URL ### Request Body ```json { "entry": [ { "id": "345533925309564", "time": 1718052945, "changes": [ { "field": "join_intent", "value": { "destination_api_name": "string", "joining_user": "string", "lobby_session_id": "string", "match_session_id": "string" } } ] } ], "object": "application" } ``` ### Parameters #### Request Body - Value Object Fields - **destination_api_name** (string) - Required - API name of the destination the user is intending to join. - **joining_user** (string) - Required - ID of the user who is joining. - **lobby_session_id** (string) - Required - Lobby session ID that the user intends to join. - **match_session_id** (string) - Required - Match session ID that the user intends to join. ### Response #### Success Response (200) An acknowledgment that the webhook notification was received. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Join Intent Webhook Notification Example Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-webhooks-getting-started This example demonstrates the JSON payload for a 'join_intent' webhook event. It specifies the field, the user joining, and session IDs for multiplayer game notifications. ```json { "entry": [ { "id": "345533925309564", "time": 1718052945, "changes": [ { "field": "join_intent", "value": { "destination_api_name": "destination_api_name", "joining_user": "10149999707612630", "lobby_session_id": "test_lobby_session_id", "match_session_id": "test_match_session_id" } } ] } ], "object": "application" } ``` -------------------------------- ### Get Challenge Score Entries Request Example (HTTP) Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-challenges-s2s Example HTTP GET request to retrieve score entries for a challenge. Includes the Host header and an Authorization header with a bearer token. ```http GET /1234757621998335/entries Host: graph.oculus.com Authorization: Bearer OC|1234757621998335|1234f7a788b0c0b270f9691d0a06d5a5 ``` -------------------------------- ### Clone Unity Starter Samples Repository Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/unity-starter-samples This command-line instruction shows how to clone the Unity Starter Samples project from its GitHub repository. It's a prerequisite for accessing the sample scenes and code. ```sh git clone https://github.com/oculus-samples/Unity-StarterSamples.git ``` -------------------------------- ### Example Account Linking Redirect with Parameters Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-account-linking An example of a GET request to Meta's SSO URI, including a sample login URI and organization ID, to facilitate account linking. ```plaintext https://auth.oculus.com/sso/?redirect_uri=https://someloginuri.com/oa&organization_id=1234567812345678 ``` -------------------------------- ### Initializing Colocation Launcher (C#) Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/unity-colocation-deep-dive Illustrates the initialization of the ColocationLauncher class with various dependencies including user IDs, network adapters, and anchor managers, as part of the ColocationDriverNetObj setup. ```csharp m_colocationLauncher.Init( m_oculusUser?.ID ?? default, m_headsetGuid, NetworkAdapter.NetworkData, NetworkAdapter.NetworkMessenger, sharedAnchorManager, m_alignmentAnchorManager, overrideEventCode ); ``` -------------------------------- ### Set Is Joinable Status - C# Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-group-presence-quickstart Sets the joinable status for Group Presence. In this quickstart example, it is hardcoded to true, but in a real application, this would typically involve additional logic to determine user joinability. ```csharp options.SetIsJoinable(true); ``` -------------------------------- ### Python Helper Script for Device Wipe and Setup Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ts-scriptable-testing An example Python script that encapsulates the ADB commands for wiping and setting up a device for testing. It simplifies the process by providing a single function call, automating the sequential execution of WIPE_DEVICE and SETUP_FOR_TEST, including necessary reboots. ```python # Ready the connected device to run a test by factory resetting the device, # connecting to wifi and logging in a test user. # # testUserEmail/testUserPassword: specify the credentials of an existing Oculus test # user (https://developer.oculus.com/resources/test-users). This is the # user that will be logged into the device after it's been reset. Generally, these # email addresses are in the @tfbnw.net domain. # # testUserPin: if the device is in a logged in state, then it must be a developer # or test user that's logged in AND (for security purposes) this parameter must # specify that user's Store PIN. If calling this method when the device ``` -------------------------------- ### Clone MRUK Sample Project Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/unity-mr-utility-kit-samples This command-line instruction is used to download the MRUK Sample project from its GitHub repository. It requires Git to be installed on the user's machine. ```sh git clone https://github.com/oculus-samples/Unity-MRUtilityKitSample.git ``` -------------------------------- ### Get Bone IDs with OVR Skeleton API Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/unity-handtracking-interactions Retrieve bone identification information from the OVR Skeleton API in Unity. This includes getting the start and end bone IDs for iterating through present bone IDs and obtaining the total count of bones and skinnable bones, differentiating between them by excluding fingertip anchors from skinnable bones. ```csharp /// /// Gets the starting bone ID for the current skeleton type. /// /// The starting bone ID. public int GetCurrentStartBoneID(); /// /// Gets the ending bone ID for the current skeleton type. /// /// The ending bone ID. public int GetCurrentEndBoneId(); /// /// Gets the total number of bones in the current skeleton type. /// /// The total number of bones. public int GetCurrentNumBones(); /// /// Gets the total number of skinnable bones in the current skeleton type. /// /// The total number of skinnable bones. public int GetCurrentNumSkinnableBones(); ``` -------------------------------- ### Track Order Status Changes (JSON) Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-webhooks-getting-started This event is sent when a user purchases or updates an add-on. It is used to track new purchases and refunds for your application. The event includes details such as user ID, product SKU, and notification type. ```json { "entry": { "id": "345533925309564", "time": 1718052945, "changes": [ { "field": "order_status", "value": { "event_time": "1659742639", "user_id": "10149999707612630", "product_info": { "notification_type": "PURCHASED", "reporting_id": "03f8833e-9c02-4fa0-978f-4cfe91f86bae", "sku": "item_sku_1", "developer_payload": "{\"quoteId\": 1234567}" } } } ] } } ``` -------------------------------- ### Fetch Subscriptions (cURL) Source: https://developers.meta.com/horizon/llmstxt/documentation/unity/ps-subscriptions-s2s Example cURL request to fetch subscription data, including current and next price terms, trial information, and renewal times. This request uses GET parameters to specify the fields to retrieve. ```shell curl -d "access_token=OC|$APP_ID|$APP_SECRET" -d "fields=id,sku,owner{id},is_active,is_trial,trial_type,cancellation_time,period_start_time,period_end_time,next_renewal_time,current_price_term{term,currency,price},next_price_term{term,currency,price}" -G https://graph.oculus.com/application/subscriptions ```