### Send Sticker Pack to WhatsApp (iOS Swift) Source: https://context7.com/whatsapp/stickers/llms.txt This code snippet demonstrates how to send a sticker pack to WhatsApp using inter-app communication. It first checks if WhatsApp is installed and then initiates the sending process, providing feedback on success or failure. Dependencies include the StickerPack and Interoperability modules. ```swift import UIKit // Assume stickerPack and Interoperability are defined elsewhere // Check if WhatsApp is installed if !Interoperability.canSend() { let alert = UIAlertController( title: "WhatsApp Not Installed", message: "Please install WhatsApp to use stickers", preferredStyle: .alert ) alert.addAction(UIAlertAction(title: "OK", style: .default)) present(alert, animated: true) return } // Send sticker pack to WhatsApp stickerPack.sendToWhatsApp { success in if success { print("Sticker pack sent to WhatsApp successfully") // WhatsApp will open automatically } else { print("Failed to send sticker pack") let alert = UIAlertController( title: "Error", message: "Failed to prepare sticker pack for WhatsApp", preferredStyle: .alert ) alert.addAction(UIAlertAction(title: "OK", style: .default)) self.present(alert, animated: true) } } ``` -------------------------------- ### Android ContentProvider Query for Sticker Pack Metadata Source: https://context7.com/whatsapp/stickers/llms.txt Query all available sticker packs or a specific pack by identifier through the StickerContentProvider. This allows apps to retrieve metadata about installed sticker packs. ```APIDOC ## GET /whatsapp/stickers/android/metadata ### Description Retrieves metadata for sticker packs available via the Android ContentProvider. This endpoint allows querying for all sticker packs or a specific pack using its identifier. ### Method GET ### Endpoint `content://com.example.samplestickerapp.stickercontentprovider/metadata` `content://com.example.samplestickerapp.stickercontentprovider/metadata/[sticker_pack_identifier]` ### Parameters #### Query Parameters * **sticker_pack_identifier** (string) - Optional - The unique identifier of the sticker pack to query. If omitted, all sticker packs are returned. #### Request Body None ### Response #### Success Response (200) Returns a Cursor containing sticker pack metadata. Fields include: - **sticker_pack_identifier** (string) - The unique ID of the sticker pack. - **sticker_pack_name** (string) - The display name of the sticker pack. - **sticker_pack_publisher** (string) - The name of the sticker pack publisher. - **sticker_pack_icon** (string) - The URI or filename of the tray icon for the sticker pack. - **android_play_store_link** (string) - Link to the Android Play Store page for the sticker pack. - **ios_app_download_link** (string) - Link to the iOS App Store page for the sticker pack. - **animated_sticker_pack** (integer) - 1 if the pack contains animated stickers, 0 otherwise. #### Response Example ```json [ { "sticker_pack_identifier": "pack_001", "sticker_pack_name": "Awesome Stickers", "sticker_pack_publisher": "Sticker Co.", "sticker_pack_icon": "icon_pack_001.png", "android_play_store_link": "https://play.google.com/store/apps/details?id=com.stickerco.awesomepack", "ios_app_download_link": "https://apps.apple.com/us/app/id123456789", "animated_sticker_pack": 0 } ] ``` ``` -------------------------------- ### Android WhatsApp Sticker Pack Integration Check Source: https://context7.com/whatsapp/stickers/llms.txt Checks if WhatsApp is installed on the device and if a specific sticker pack has been whitelisted (added by the user). It uses Android's PackageManager to check for WhatsApp installations and a provided WhitelistCheck class for whitelisting status. The code handles cases where WhatsApp is not installed and launches an intent to add the sticker pack if it's not whitelisted. ```java PackageManager packageManager = context.getPackageManager(); // Check if WhatsApp is installed boolean isWhatsAppInstalled = WhitelistCheck.isWhatsAppConsumerAppInstalled(packageManager); boolean isWhatsAppBusinessInstalled = WhitelistCheck.isWhatsAppSmbAppInstalled(packageManager); if (!isWhatsAppInstalled && !isWhatsAppBusinessInstalled) { Toast.makeText(context, "WhatsApp is not installed", Toast.LENGTH_SHORT).show(); return; } // Check if sticker pack is whitelisted (user has added it) String packIdentifier = "pack_001"; boolean isWhitelisted = WhitelistCheck.isWhitelisted(context, packIdentifier); if (isWhitelisted) { Log.d("WhatsApp", "Sticker pack already added to WhatsApp"); } else { // Launch intent to add sticker pack to WhatsApp Intent intent = new Intent(); intent.setAction("com.whatsapp.intent.action.ENABLE_STICKER_PACK"); intent.putExtra("sticker_pack_id", packIdentifier); intent.putExtra("sticker_pack_authority", BuildConfig.CONTENT_PROVIDER_AUTHORITY); intent.putExtra("sticker_pack_name", "My Stickers"); try { context.startActivityForResult(intent, 200); } catch (ActivityNotFoundException e) { Toast.makeText(context, "Action not supported", Toast.LENGTH_SHORT).show(); } } ``` -------------------------------- ### Validate Sticker Pack Compliance - Android Source: https://context7.com/whatsapp/stickers/llms.txt Provides a Java code example for validating sticker pack compliance with WhatsApp's requirements. This includes checking sticker dimensions, file sizes, formats (WebP), and associations with emojis. The `StickerPackValidator.verifyStickerPackValidity` method is used, and the code demonstrates how to create `StickerPack` and `Sticker` objects and catch potential `IllegalStateException` errors during validation. ```java try { StickerPack stickerPack = new StickerPack( "pack_001", "My Stickers", "Publisher Name", "tray_icon.png", "publisher@email.com", "https://publisher.com", "https://publisher.com/privacy", "https://publisher.com/license", "1", false, false ); // Add stickers to the pack for (int i = 0; i < 5; i++) { Sticker sticker = new Sticker("sticker_" + i + ".webp", Arrays.asList("😀", "👍")); sticker.setSize(45000); // bytes stickerPack.getStickers().add(sticker); } // Validate the pack StickerPackValidator.verifyStickerPackValidity(context, stickerPack); Log.d("Validation", "Sticker pack is valid"); } catch (IllegalStateException e) { Log.e("Validation", "Validation failed: " + e.getMessage()); // Handle specific errors: // - Identifier/name/publisher too long (>128 chars) // - Tray image too large (>50KB) // - Sticker count not between 3-30 // - Static stickers >100KB or animated >500KB // - Image dimensions not 512x512 } ``` -------------------------------- ### iOS Sticker Pack Initialization in Swift Source: https://context7.com/whatsapp/stickers/llms.txt Initializes and configures a sticker pack in iOS using Swift, including adding individual stickers with their associated emojis and accessibility text. The code includes error handling for common issues such as file not found, image size exceeding limits, and incorrect image dimensions, ensuring robust sticker pack creation. ```swift import UIKit do { // Initialize sticker pack from file let stickerPack = try StickerPack( identifier: "pack_001", name: "Cute Animals", publisher: "Sticker Studio", trayImageFileName: "tray_animals.png", animatedStickerPack: false, publisherWebsite: "https://stickerstudio.com", privacyPolicyWebsite: "https://stickerstudio.com/privacy", licenseAgreementWebsite: "https://stickerstudio.com/license" ) // Add stickers to pack try stickerPack.addSticker( contentsOfFile: "dog_happy.webp", emojis: ["🐶", "😊", "❤️"], accessibilityText: "A happy golden retriever with its tongue out" ) try stickerPack.addSticker( contentsOfFile: "cat_sleeping.webp", emojis: ["😺", "😴"], accessibilityText: "An orange tabby cat sleeping peacefully" ) print("Sticker pack created: (stickerPack.name)") print("Total size: (stickerPack.formattedSize)") print("Sticker count: (stickerPack.stickers.count)") } catch StickerPackError.fileNotFound { print("Error: Image file not found in bundle") } catch StickerPackError.imageTooBig(let size, let isAnimated) { let maxSize = isAnimated ? Limits.MaxAnimatedStickerFileSize : Limits.MaxStaticStickerFileSize print("Error: Image is (size) bytes, maximum is (maxSize) bytes") } catch StickerPackError.incorrectImageSize(let size) { print("Error: Image size is (size), required size is (Limits.ImageDimensions)") } catch { print("Error creating sticker pack: (error)") } ``` -------------------------------- ### Info.plist URL Scheme Configuration (XML) Source: https://github.com/whatsapp/stickers/blob/main/iOS/README.md Configures the application's Info.plist file to allow querying the 'whatsapp' URL scheme. This is necessary for your app to detect if it can open URLs using the 'whatsapp://' scheme, enabling interaction with the WhatsApp application. ```xml LSApplicationQueriesSchemes whatsapp ``` -------------------------------- ### Expose Internal Files as Stickers using ContentProvider (Java) Source: https://github.com/whatsapp/stickers/blob/main/Android/README.md This Java code snippet demonstrates how to fetch internal sticker files and expose them via an AssetFileDescriptor. It copies assets to the external cache directory and creates a ParcelFileDescriptor for read-only access. This method is useful for serving downloaded or pre-existing sticker files. ```java private AssetFileDescriptor fetchFile(@NonNull Uri uri, @NonNull AssetManager am, @NonNull String fileName, @NonNull String identifier) throws IOException { final File cacheFile = getContext().getExternalCacheDir(); final File file = new File(cacheFile, fileName); try (final InputStream open = am.open(identifier + "/" + fileName); final FileOutputStream fileOutputStream = new FileOutputStream(file)) { byte[] buffer = new byte[1024]; int read; while ((read = in.read(buffer)) != -1) { out.write(buffer, 0, read); } } //The code above is basically copying the assets to storage, and servering the file off of the storage. //If you have the files already downloaded/fetched, you could simply replace above part, and initialize the file parameter with your own file which points to the desired file. //The key here is you can use ParcelFileDescriptor to create an AssetFileDescriptor. return new AssetFileDescriptor(ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY), 0, AssetFileDescriptor.UNKNOWN_LENGTH); } ``` -------------------------------- ### Create iOS Sticker Pack from Dynamic Image Data Source: https://context7.com/whatsapp/stickers/llms.txt Demonstrates programmatic creation of an iOS sticker pack using raw image data. This allows for dynamic sticker generation from sources like user uploads or network fetches. It covers initializing the pack, adding stickers with type, emojis, and accessibility text, and includes error handling for common issues like too many emojis or invalid sticker counts. ```swift import UIKit do { // Create sticker pack let stickerPack = try StickerPack( identifier: "dynamic_pack", name: "Dynamic Stickers", publisher: "My App", trayImageFileName: "tray.png", animatedStickerPack: false, publisherWebsite: "https://myapp.com", privacyPolicyWebsite: nil, licenseAgreementWebsite: nil ) // Load image data (e.g., from network or user-generated) guard let imageData = UIImage(named: "custom_sticker")?.pngData() else { throw StickerPackError.invalidImage } // Add sticker from raw data try stickerPack.addSticker( imageData: imageData, type: .png, emojis: ["✨", "🎨"], accessibilityText: "A custom user-created sticker" ) // Verify constraints if stickerPack.stickers.count < Limits.MinStickersPerPack { print("Need at least \(Limits.MinStickersPerPack) stickers") } else if stickerPack.stickers.count > Limits.MaxStickersPerPack { print("Maximum \(Limits.MaxStickersPerPack) stickers allowed") } else { print("Ready to send: \(stickerPack.stickers.count) stickers") } } catch StickerPackError.tooManyEmojis { print("Error: Maximum \(Limits.MaxEmojisCount) emojis per sticker") } catch StickerPackError.stickersNumOutsideAllowableRange { print("Error: Sticker count must be \(Limits.MinStickersPerPack)-\(Limits.MaxStickersPerPack)") } catch { print("Error: \(error)") } ``` -------------------------------- ### Create StickerPack Object (Swift) Source: https://github.com/whatsapp/stickers/blob/main/iOS/README.md Instantiates a StickerPack object with essential details for a sticker pack. This method may throw an exception if parameters do not meet WhatsApp's requirements. It requires specific string values for identification, naming, publisher information, and image file names. ```swift let stickerPack = StickerPack(identifier: "identifier", name: "sticker pack name", publisher: "sticker pack publisher", trayImageFileName: "tray image file name", publisherWebsite: "publisher website URL", privacyPolicyWebsite: "privacy policy website URL", licenseAgreementWebsite: "license agreement website URL") ``` -------------------------------- ### WhatsApp Stickers API Source: https://github.com/whatsapp/stickers/blob/main/iOS/README.md This section details the Swift API provided for creating and managing sticker packs programmatically. ```APIDOC ## Create Sticker Pack ### Description Instantiate a new `StickerPack` object to begin creating a sticker pack. ### Method `StickerPack` Initializer ### Endpoint N/A (Local Swift Object) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift let stickerPack = StickerPack(identifier: "identifier", name: "sticker pack name", publisher: "sticker pack publisher", trayImageFileName: "tray image file name", publisherWebsite: "publisher website URL", privacyPolicyWebsite: "privacy policy website URL", licenseAgreementWebsite: "license agreement website URL") ``` ### Response #### Success Response (200) N/A (Object Creation) #### Response Example N/A --- ## Add Sticker to Pack ### Description Add individual stickers to an existing `StickerPack` object. ### Method `StickerPack.addSticker()` ### Endpoint N/A (Local Swift Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift stickerPack.addSticker(contentsOfFile: "file name of sticker image", emojis: ["array of emojis"]) ``` ### Response #### Success Response (200) N/A (Method Execution) #### Response Example N/A --- ## Import Sticker Pack to WhatsApp ### Description Import the created sticker pack into the WhatsApp application. ### Method `StickerPack.sendToWhatsApp()` ### Endpoint N/A (Local Swift Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift stickerPack.sendToWhatsApp { completed in // Called when the sticker pack has been wrapped in a form that WhatsApp // can read and WhatsApp is about to open. } ``` ### Response #### Success Response (200) Callback indicating completion. #### Response Example N/A ``` -------------------------------- ### Import Sticker Pack to WhatsApp (Swift) Source: https://github.com/whatsapp/stickers/blob/main/iOS/README.md Initiates the process of importing a sticker pack into the WhatsApp application. This method opens WhatsApp with a preview of the pack, allowing the user to add it to their sticker collection. The completion handler is called when the pack is ready for WhatsApp to read. ```swift stickerPack.sendToWhatsApp { completed in // Called when the sticker pack has been wrapped in a form that WhatsApp // can read and WhatsApp is about to open. } ``` -------------------------------- ### Android Sticker Pack JSON Configuration Source: https://context7.com/whatsapp/stickers/llms.txt Defines the metadata and sticker details for a sticker pack in a JSON format for Android applications. This file includes links to the Play Store and App Store, pack information such as identifier, name, publisher, and tray image, as well as individual sticker definitions with image files, emojis, and accessibility text. ```json { "android_play_store_link": "https://play.google.com/store/apps/details?id=com.example.stickers", "ios_app_store_link": "https://apps.apple.com/app/id123456789", "sticker_packs": [ { "identifier": "pack_001", "name": "Cute Animals", "publisher": "Sticker Studio", "tray_image_file": "tray_animals.png", "image_data_version": "1", "avoid_cache": false, "publisher_email": "support@stickerstudio.com", "publisher_website": "https://stickerstudio.com", "privacy_policy_website": "https://stickerstudio.com/privacy", "license_agreement_website": "https://stickerstudio.com/license", "animated_sticker_pack": false, "stickers": [ { "image_file": "dog_happy.webp", "emojis": ["🐶", "😊", "❤️"], "accessibility_text": "A happy golden retriever with its tongue out" }, { "image_file": "cat_sleeping.webp", "emojis": ["😺", "😴"], "accessibility_text": "An orange tabby cat sleeping peacefully" } ] } ] } ``` -------------------------------- ### Configure StickerContentProvider in AndroidManifest.xml Source: https://github.com/whatsapp/stickers/blob/main/Android/README.md This XML snippet shows the necessary configuration for the StickerContentProvider in the AndroidManifest.xml file. It specifies the provider's name, authority, and permissions, ensuring it is enabled and exported for WhatsApp to access sticker data. ```xml ``` -------------------------------- ### Launch Intent to Add Sticker Pack to WhatsApp (Java) Source: https://github.com/whatsapp/stickers/blob/main/Android/README.md This Java code snippet illustrates how to create and launch an Intent to enable a sticker pack in WhatsApp. It sets the action to 'com.whatsapp.intent.action.ENABLE_STICKER_PACK' and includes essential extras like the sticker pack ID, authority, and name. It also includes error handling for cases where the WhatsApp application is not found. ```java Intent intent = new Intent(); intent.setAction("com.whatsapp.intent.action.ENABLE_STICKER_PACK"); intent.putExtra("sticker_pack_id", identifier); //identifier is the pack's identifier in contents.json file intent.putExtra("sticker_pack_authority", authority); //authority is the ContentProvider's authority. In the case of the sample app it is BuildConfig.CONTENT_PROVIDER_AUTHORITY. intent.putExtra("sticker_pack_name", stickerPackName); //stickerPackName is the name of the sticker pack. try { startActivityForResult(intent, 200); } catch (ActivityNotFoundException e) { Toast.makeText(this, R.string.error_adding_sticker_pack, Toast.LENGTH_LONG).show(); } ``` -------------------------------- ### Query Sticker Pack Metadata - Android ContentProvider Source: https://context7.com/whatsapp/stickers/llms.txt Demonstrates how to query all available sticker packs or a specific sticker pack by its identifier using Android's ContentProvider. This involves constructing specific URIs and using a Cursor to retrieve metadata such as pack identifier, name, publisher, icon, and store links. It requires access to the application's ContentResolver and the correct ContentProvider authority. ```java Application // Query all sticker packs Uri metadataUri = new Uri.Builder() .scheme(ContentResolver.SCHEME_CONTENT) .authority("com.example.samplestickerapp.stickercontentprovider") .appendPath("metadata") .build(); Cursor cursor = contentResolver.query(metadataUri, null, null, null, null); if (cursor != null && cursor.moveToFirst()) { do { String identifier = cursor.getString(cursor.getColumnIndexOrThrow("sticker_pack_identifier")); String name = cursor.getString(cursor.getColumnIndexOrThrow("sticker_pack_name")); String publisher = cursor.getString(cursor.getColumnIndexOrThrow("sticker_pack_publisher")); String trayIcon = cursor.getString(cursor.getColumnIndexOrThrow("sticker_pack_icon")); String androidLink = cursor.getString(cursor.getColumnIndexOrThrow("android_play_store_link")); String iosLink = cursor.getString(cursor.getColumnIndexOrThrow("ios_app_download_link")); boolean isAnimated = cursor.getInt(cursor.getColumnIndexOrThrow("animated_sticker_pack")) == 1; Log.d("StickerPack", "Pack: " + name + " by " + publisher); } while (cursor.moveToNext()); cursor.close(); } // Query specific sticker pack Uri singlePackUri = new Uri.Builder() .scheme(ContentResolver.SCHEME_CONTENT) .authority("com.example.samplestickerapp.stickercontentprovider") .appendPath("metadata") .appendPath("1") // identifier .build(); ``` -------------------------------- ### Manual JSON Structure for WhatsApp Source: https://github.com/whatsapp/stickers/blob/main/iOS/README.md This section describes the JSON structure required for sending sticker packs to WhatsApp manually via the pasteboard and URL scheme. ```APIDOC ## Manual Sticker Pack Import ### Description Manually format sticker pack data into a JSON object and send it to WhatsApp via the pasteboard and URL scheme. ### Method URL Scheme (`whatsapp://stickerPack`) with Pasteboard ### Endpoint `whatsapp://stickerPack` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body N/A (Data is sent via Pasteboard) ### Request Example ```json { "ios_app_store_link" : "String", "android_play_store_link" : "String", "identifier" : "String", "name" : "String", "publisher" : "String", "tray_image" : "String", (Base64 representation of the PNG, not WebP, data of the tray image) "stickers" : [ { "image_data" : "String", (Base64 representation of the WebP, not PNG, data of the sticker image) "emojis" : ["String", "String"], (Array of emoji strings. Maximum of 3 emoji) "accessibility_text": "String" (Accessibility description. Maximum of 255 characters for animated stickers or 125 characters for static stickers.) } ] } ``` ### Response #### Success Response (200) WhatsApp opens with a preview of the sticker pack. #### Response Example N/A ``` -------------------------------- ### Load Sticker Packs from JSON (iOS Swift) Source: https://context7.com/whatsapp/stickers/llms.txt This Swift code loads and parses sticker pack data from a JSON file. It uses the StickerPackManager to fetch sticker packs and then iterates through them to print details. The code includes error handling for file not found and other potential issues during loading. It's designed to populate UI elements like table views. ```swift import Foundation // Assume StickerPackManager, StickerPackError, and Limits are defined elsewhere do { let json = try StickerPackManager.stickersJSON(contentsOfFile: "stickers") StickerPackManager.fetchStickerPacks(fromJSON: json) { stickerPacks in print("Loaded \(stickerPacks.count) sticker packs") for pack in stickerPacks { print("Pack: \(pack.name)") print("Publisher: \(pack.publisher)") print("Identifier: \(pack.identifier)") print("Stickers: \(pack.stickers.count)") print("Animated: \(pack.animated)") print("Size: \(pack.formattedSize)") print("---") } // Display in UI (assuming self.stickerPacks and self.tableView exist) // self.stickerPacks = stickerPacks // self.tableView.reloadData() } } catch StickerPackError.fileNotFound { print("Error: stickers.wasticker file not found in bundle") } catch { print("Error loading sticker packs: \(error)") } ``` -------------------------------- ### Sticker Pack JSON Structure (JSON) Source: https://github.com/whatsapp/stickers/blob/main/iOS/README.md Defines the JSON structure required for sending sticker pack data to WhatsApp. This includes links to app stores, pack metadata, a base64 encoded PNG for the tray image, and an array of stickers, each with base64 encoded WebP image data, emojis, and accessibility text. ```json { "ios_app_store_link" : "String", "android_play_store_link" : "String", "identifier" : "String", "name" : "String", "publisher" : "String", "tray_image" : "String", (Base64 representation of the PNG, not WebP, data of the tray image) "stickers" : [ { "image_data" : "String", (Base64 representation of the WebP, not PNG, data of the sticker image) "emojis" : ["String", "String"], (Array of emoji strings. Maximum of 3 emoji) "accessibility_text": "String" (Accessibility description. Maximum of 255 characters for animated stickers or 125 characters for static stickers.) } ] } ``` -------------------------------- ### Validate and Convert Image Data for Stickers (iOS Swift) Source: https://context7.com/whatsapp/stickers/llms.txt This Swift code handles the validation and conversion of image data for WhatsApp stickers. It checks if an image file (preferably WebP) meets size, dimension, and format requirements. It can extract image data, display it as a UIImage, and provide WebP data for transmission. Error handling is included for common compliance issues. ```swift import UIKit // Assume ImageData, StickerPackError, Limits, and imageView are defined elsewhere do { // Load and validate image from file (e.g., "sticker_001.webp") let imageData = try ImageData.imageDataIfCompliant( contentsOfFile: "sticker_001.webp", isTray: false ) print("Image type: \(imageData.type.rawValue)") print("File size: \(imageData.bytesSize) bytes") print("Is animated: \(imageData.animated)") if imageData.animated { print("Min frame duration: \(imageData.minFrameDuration) ms") print("Total duration: \(imageData.totalAnimationDuration) ms") } // Get UIImage for display if let image = imageData.image { // imageView.image = image // Assign to your ImageView print("Image dimensions: \(image.size)") } // Get WebP data for transmission if let webpData = imageData.webpData { print("WebP data size: \(webpData.count) bytes") // Use this webpData for sending to WhatsApp } } catch StickerPackError.imageTooBig(let size, let isAnimated) { let maxSize = isAnimated ? Limits.MaxAnimatedStickerFileSize : Limits.MaxStaticStickerFileSize print("Image too large: \(size) bytes (max: \(maxSize) bytes)") } catch StickerPackError.incorrectImageSize(let dimensions) { print("Incorrect dimensions: \(dimensions), required: \(Limits.ImageDimensions)") } catch StickerPackError.unsupportedImageFormat(let format) { print("Unsupported format: \(format). Use PNG or WebP") } catch { print("Image validation error: \(error)") } ``` -------------------------------- ### Android Sticker Pack Validation Source: https://context7.com/whatsapp/stickers/llms.txt Validates a sticker pack against WhatsApp's requirements, including dimensions, file sizes, format specifications, and content limits. This is crucial before submitting a sticker pack. ```APIDOC ## POST /whatsapp/stickers/android/validate ### Description Validates a sticker pack to ensure it meets WhatsApp's technical specifications. This process checks sticker dimensions, file sizes, formats (WebP), and the number of stickers per pack. ### Method POST ### Endpoint `/whatsapp/stickers/android/validate` ### Parameters #### Request Body - **stickerPack** (object) - Required - An object representing the sticker pack to be validated. It should contain: - **identifier** (string) - Unique identifier for the sticker pack. - **name** (string) - Display name of the sticker pack. - **publisher** (string) - Name of the publisher. - **trayIconFileURI** (string) - URI of the tray icon file. - **publisherEmail** (string) - Publisher's email address. - **publisherWebsite** (string) - Publisher's website URL. - **privacyPolicyWebsite** (string) - URL to the privacy policy. - **licenseAgreementWebsite** (string) - URL to the license agreement. - **animatedStickerPack** (boolean) - True if the pack contains animated stickers, false otherwise. - **stickers** (array) - An array of sticker objects. Each sticker object should contain: - **imageFileURI** (string) - URI of the sticker image file. - **emojis** (array of strings) - Associated emojis for the sticker. - **size** (integer) - File size of the sticker in bytes (optional, validation will check defaults). ### Request Example ```json { "identifier": "pack_001", "name": "My Awesome Stickers", "publisher": "My Company", "trayIconFileURI": "file:///path/to/tray_icon.png", "publisherEmail": "contact@mycompany.com", "publisherWebsite": "https://mycompany.com", "privacyPolicyWebsite": "https://mycompany.com/privacy", "licenseAgreementWebsite": "https://mycompany.com/license", "animatedStickerPack": false, "stickers": [ { "imageFileURI": "file:///path/to/sticker1.webp", "emojis": ["😀", "😂", "😊"] }, { "imageFileURI": "file:///path/to/sticker2.webp", "emojis": ["👍", "👌"] } ] } ``` ### Response #### Success Response (200) Indicates that the sticker pack is valid and meets all WhatsApp requirements. #### Error Response (400/422) Returns a detailed error message if the sticker pack fails validation. Common errors include: - Identifier or name too long. - Tray icon file size exceeds limit. - Sticker count outside the allowed range (3-30). - Sticker file size exceeds limits (static: 100KB, animated: 500KB). - Image dimensions are not 512x512 pixels. - Invalid image format (must be WebP). #### Response Example ```json { "message": "Validation successful." } ``` #### Error Example ```json { "message": "Validation failed: Sticker count must be between 3 and 30." } ``` ``` -------------------------------- ### Add Sticker to StickerPack (Swift) Source: https://github.com/whatsapp/stickers/blob/main/iOS/README.md Adds an individual sticker to a previously created StickerPack object. This function takes the file name of the sticker image and an array of associated emojis as input. Ensure the image file exists and emojis meet the specified criteria. ```swift stickerPack.addSticker(contentsOfFile: "file name of sticker image", emojis: ["array of emojis"]) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.