A minimal WordPress plugin that provides a Gutenberg block for embedding BubbleHouse iframes with JWT authentication.
This single-file plugin creates a Gutenberg block that renders secure BubbleHouse iframes. It automatically generates JWT tokens for authentication and supports customer-specific content delivery.
- Gutenberg block (
bubblehouse/iframe) for easy iframe embedding - JWT token generation with HS256 algorithm
- Customer ID integration for personalized content
- Configurable iframe height and page selection
- Secure iframe with sandbox attributes
- Automatic BubbleHouse JavaScript loading
- Upload
bubblehouse-woocommerce.phpto your/wp-content/plugins/directory - Activate the plugin through the WordPress admin panel
- Configure the plugin settings at Settings → BubbleHouse
Navigate to Settings → BubbleHouse in your WordPress admin to configure the plugin.
- Host: API host (defaults to
app.bubblehouse.com) - Shop Slug: Your unique shop identifier from BubbleHouse
- KID: Key ID from your BubbleHouse dashboard
- Shared Secret: Base64 encoded secret from your BubbleHouse dashboard
- Log into your BubbleHouse dashboard
- Locate API section in the sidebar and navigate to the page
- Copy your KID and Shared Secret values (or create a new one)
- Paste them into the plugin settings
- Edit any page or post in the Gutenberg editor
- Add a new block and search for "BubbleHouse Iframe"
- Configure the block settings in the sidebar:
- Page: BubbleHouse page name (default:
Rewards7) - Height: Iframe height in pixels (default:
600)
- Page: BubbleHouse page name (default:
page: The BubbleHouse page identifier to loadheight: The iframe height in pixels
The plugin generates JWT tokens with the following specifications:
- Algorithm: HS256
- Header: Contains
typ,alg, andkidfields - Payload: Contains
aud: "BH",sub,iat, andexpfields - Expiration: 1 hour (3600 seconds)
- Logged-in users: JWT subject =
{shop_slug}/{user_id} - Anonymous users: JWT subject =
{shop_slug}
https://{host}/blocks/v2023061/{shop_slug}/{page}?instance=bhpage&auth={jwt_token}
The iframe includes these sandbox attributes for security:
allow-top-navigationallow-scriptsallow-formsallow-modalsallow-popupsallow-popups-to-escape-sandboxallow-same-origin
Plus allow="clipboard-write" for clipboard access.
bubblehouse-woocommerce.php # Main plugin file
README.md # Documentation
bubblehouse_init(): Registers the Gutenberg blockbubblehouse_render_iframe_block(): Renders the iframe HTMLbubblehouse_generate_jwt(): Creates JWT tokens
bubblehouse_admin_init(): Registers plugin settingsbubblehouse_admin_menu(): Adds the admin menu itembubblehouse_settings_page(): Renders the settings page
Iframe not loading
- Verify all plugin settings are configured
- Check that your KID and Shared Secret are correct
- Ensure your Shop Slug matches your BubbleHouse account
JWT authentication errors
- Confirm your Shared Secret is properly base64 encoded
- Verify your KID matches what's in your BubbleHouse dashboard
- Check that your server time is synchronized
Block not appearing in editor
- Ensure Gutenberg is enabled
- Clear your browser cache
- Verify the plugin is activated
"Missing required configuration"
- Configure all settings in Settings → BubbleHouse
- Make sure no required fields are empty
- WordPress: 5.0 or higher
- PHP: 7.4 or higher
- Gutenberg: Block editor must be enabled
For technical support:
- Check the BubbleHouse documentation
- Verify your plugin configuration
- Contact the BubbleHouse support team
- Initial release
- Gutenberg block implementation
- JWT token generation
- Admin settings interface