Developer Access

Please enter the developer password to access the SDK

myVibe SDK Documentation

Contents

Introduction

Welcome to the myVibe SDK documentation. This SDK allows third-party developers to create micro-applications for the myVibe smart sex toy management platform.

Note: The myVibe SDK is designed to work within the myVibe app environment. Your micro-application will be loaded in iframe containers within the main app, with safe access to device control features through our secure API.

What You Can Build

The myVibe SDK enables you to build a variety of experiences:

Key Features

Architecture

The myVibe SDK follows a parent-child communication model:

+------------------------+
|      myVibe App       |
|   (Native iOS/Android) |
|                        |
|   +----------------+   |
|   |  WebView       |   |
|   |                |   |
|   |  +---------+   |   |
|   |  | iframes |   |   |
|   |  +---------+   |   |
|   +----------------+   |
+------------------------+
         |
         | Bluetooth
         v
+------------------------+
|      Smart Device      |
+------------------------+

Your micro-application runs in an iframe within the main application's WebView. The SDK provides a communication bridge between your micro-application and the main app, which handles the Bluetooth communication with the physical device.

Communication Flow

  1. Your app uses the SDK methods to request actions (e.g., changing vibration intensity)
  2. The SDK sends these requests to the parent application via postMessage
  3. The parent app processes the request and sends commands to the connected device
  4. The parent app sends events back to your app (e.g., device disconnection, battery status)

Security Note: This architecture ensures that micro-applications never have direct access to the Bluetooth API or device communication, maintaining security and privacy for users.

Integration Guide

Follow these steps to integrate the myVibe SDK into your micro-application:

1. Include the SDK

Add the following script tag to your HTML file:

<script src="https://app.myvibe.tech/sdk/myvibe-sdk.js"></script>

2. Initialize the SDK

Create a new instance of the SDK with your application configuration:

const myVibeApp = new MyVibeSDK.App({
    name: "Your App Name",         // Required
    version: "1.0.0",              // Optional, defaults to "1.0.0"
    permissions: ["vibration", "patterns"]  // Optional, defaults to ["basic"]
});

3. Set Up Event Handlers

Register callback functions for important events:

// Handle device connection
myVibeApp.onDeviceConnected(device => {
    console.log(`Connected to ${device.name}`);
    // Update your UI to show connected state
});

// Handle device disconnection
myVibeApp.onDeviceDisconnected(device => {
    console.log(`Disconnected from ${device.name}`);
    // Update your UI to show disconnected state
});

// Handle low battery warning
myVibeApp.onBatteryLow(level => {
    console.log(`Battery low: ${level}%`);
    // Show low battery warning
});

// Handle pattern completion
myVibeApp.onPatternComplete(pattern => {
    console.log(`Pattern "${pattern.name}" completed`);
    // Update UI or start next action
});

4. Control the Device

Use the SDK methods to control the connected device:

// Basic vibration control
myVibeApp.setVibration(50);  // Set to 50% intensity

// Create and play a pattern
const pulsePattern = myVibeApp.createPattern({
    name: "Pulse",
    steps: [
        { intensity: 100, duration: 500 },
        { intensity: 0, duration: 300 },
        { intensity: 100, duration: 500 }
    ],
    repeat: 3
});

myVibeApp.playPattern(pulsePattern);

// Stop all vibration
myVibeApp.stopVibration();

Important: Always provide a way for users to quickly stop all vibration. This is both a usability and safety consideration.

Permissions

The SDK uses a permission-based system to control what features your micro-application can access:

Specify the permissions your app needs during SDK initialization:

const myVibeApp = new MyVibeSDK.App({
    name: "Your App Name",
    permissions: ["vibration", "patterns", "storage"]
});

You can check if your app has a specific permission using hasPermission():

if (myVibeApp.hasPermission('patterns')) {
    // Show pattern controls
} else {
    // Hide pattern controls
}

Tip: Request only the permissions your app actually needs. This improves security and performance.

Best Practices

Follow these guidelines to create high-quality micro-applications:

User Experience

Performance

Privacy and Security

Examples

We provide several example micro-applications to help you get started:

Remote Control Example

A simple remote control interface for basic device functions:

This example demonstrates:

Pattern Designer Example

A visual tool to create custom vibration patterns:

This example demonstrates: