Remote API
Overview
The Camera Kit Web SDK enables the host application to send data from the app to the Lens to create customized experiences. For example, this could include passing sports score data or news headlines for a Lens to display, award points in your app based on user interactions within a Lens, or events based on user input to better track Lens performance. This guide walks through the different options for communication between a Lens and the host application to help tailor the experience to match the desired use case.
How It Works
Remote API can be used to send data including images, 3D models, and other data to and from the Lens, allowing the Lens to adapt to changing information from the application in real-time. This feature requires a RemoteServicesModule API Spec within the Lens, the steps to create the API Spec are below. Note that while the setup for this option relies on Snap’s Remote API system, all communication is sent directly between the host app and Lens without a Snap server involved.
Remote APIs require that all communication between the Lens and the host application needs to be initiated by the Lens. That is, the Lens will send requests to the host application and the host application will respond. If your use case requires the app to be able to send information to the Lens at any time, the recommended path is to send a request from the Lens when the Lens is first applied and respond from the app when needed.