Documentation
Setup in less than 5 minutes! Henry is a native wrapping technology that allows you to wrap your Bubble app using Thunkable while giving you access to advanced native features directly from Bubble.
Setup
Native features
Device
- Place the âHenry: Device infoâ element on the page
- On page load, the element will fetch the current device infos. You can use the elementâs states to access it from other elements of workflows. Possible states are
- Theme:
light
,dark
- Operating system:
iOS
,android
Advanced
You can also update the device infos by using the âUpdate device infoâ action in a workflow. This is useful to check if the user changed the theme during the session. Updating the device infos will also trigger an event âDevice info is updatedâ that you can use to attach some actions. â ď¸Â The event refers to the update workflow being used, not the device infos changing.
- Place the âHenry: Locationâ element on the page
- By default, the element will fetch the userâs current location on page load. You can use the elementâs states to access it from other elements of workflows.
You can use Bubbleâs Calculate formula â Coordinates to Address to convert the elementâs output coordinates (latitude + longitude) into an address)
Advanced
You can manually deactivate fetching the location on page load by unchecking the elementâs checkbox âUpdate location on page loadâ.
You can update the current location by using the âUpdate current locationâ action in a workflow. This is useful if you unchecked âUpdate location on page loadâ or the user moves during a session. Updating the location will also trigger an event âLocation is updatedâ that you can use to attach some actions. â ď¸Â The event refers to the update workflow being used, not the location changing.
Show / hide the phoneâs statusbar contents
You can show / hide the phoneâs statusbar contents. This refers just to the contents of the status bar, not the bar itself.
- Use the workflow action âHenry: Show statusbar contentsâ to show the phoneâs statusbar contents (default).
- Use the workflow action âHenry: Hide statusbar contentsâ to hide the phoneâs status bar.
Set statusbar contents style
Use the workflow action âHenry: Set statusbar content styleâ to set the style of the statusbar contents. Available options are
- light-content: light text and icons
- dark-content: dark text and icons
- default: the phoneâs current default
Set statusbar background color
Use the workflow action âHenry: Set statusbar colorâ to set the background color of the status bar. For newer iPhones, the color will be applied to the whole ânotch areaâ, which includes the status bar on the top as well as the small area on the bottom â green parts in image below.
Henry currently has two ways to deal with that
1) (recommended) You can use the âHenry: Set iOS full screenâ workflow function to adjust the size of the web view for iPhones to cover the full screen including the notch areas.
Set to full screen
Reset to normal (contain webview to save area)
2) (not recommended) You can use the âHenry: Set webview heightâ workflow function to adjust the size of the web view for iPhones to cover to bottom Notch area. This essentially hides the bottom notch-area on iPhones. For most iPhones, increasing the size by 34px will be best.:
Henry allows you to save local (i.e. offline) variable directly on the users phone. This can be useful for
- Sensitive data you donât want to save in Bubbleâs database hosted on AWS.
- As an alternative to custom states that survive a refresh of the page and are available across pages. This is faster than writing something to the database.
- Save the users login credentials. This way you can automatically log the user in when first opening the app and save the credentials offline. So, the user never has to create an account but still has a personalised experience.
At the moment Henry only supports 3 variables of type text. Here is how it works:
- Place the âHenry: Local variablesâ element on the page
- Use the âStore local variableâ workflow action to store a text value in a variable.
- On page load, the element will fetch the local variables. You can use the elementâs states to access them anytime from other elements of workflows.
â ď¸. Although the plugin allows you to store some variables offline, but you will still need an internet connection to run the app.
Interaction
- Place the âHenry: Alertsâ element on the page
- Use the âShow alertâ workflow action to display an alert. The Event âAlert IDâ is used if you want to catch if the user confirmed the alert (i.e. clicks âconfirmâ)
- If the user confirms or cancels the alert, an event âAlert is confirmed by userâ resp. âAlert is cancelled by userâ is triggered. You can use this event to create a workflow. E.g. if user confirms event with Event ID âalert 1â, do something.
Use the workflow action âHenry: Vibrateâ to make the phone vibrate.
Here is how to set it up:
- Make sure you are using the IAP & Push version of the Henry Thunkable template
- Add the âHenry: Push Notifcationsâ element to your app.
- Create a free https://onesignal.com/ account (donât set up any app yet), by following the steps outlined in Thunkable docs â Sign up with OneSignal.
- Install any OneSignal Bubble Plugin to your app. We recommend this free one here: https://bubble.io/plugin/onesignal-1550111582496x405806558737334300.
This is pretty straight forward and should only take about 5 minutes. Follow the steps outlined in Thunkable docs â Android Setup. In summary, you will need to:
- Set up and configure a Firebase account
- Configure Android settings in your OneSignal account and link your Firebase Keys
- Add your OneSignal Key to Thunkable
Please note:
- You can ignore Step 5. Toggle Location Permission.
- In Step 4. Install Your SDK you find the Push Notifications dialog to add your App ID by clicking on the Push_Notification 1 element just below the phone (see picture below â bottom right)
This is unfortunately a bit more complicated than the Android setup und will take about an hour to do:
- Follow the steps outlined in Thunkable docs â Publish to App Store (iOS) to send a build of your app to your AppStore Connect account. You donât have to do the âNext Steps - App Store Connectâ part yet.
- Follow the steps outlined in Thunkable docs â iOS Setup and add your App ID to the Thunkable Push_Notification 1 element.
- Follow the steps outlined in Thunkable docs â Adding Push Notifications to re-send your app to your AppStore Connect account.
- Test your app on your phone using TestFlight:
- Submit your app to TestFlight (see https://academy.thunkable.com/in-app-purchases/overview/ios-app-store-setup#dev7e89e149d for how to)
- Add yourself as a tester using a testing group
- Install the TestFlight app from the AppStore on your phone
- Open the TestFlight app and download your app
You can send push notifications either directly from your OneSignal account (mainly used to send notifications to all users) or from Bubble (mainly used to send notifications to specific users)
Sending push notifications from OneSignal
Go to OneSignal, find your app, click on âNew Pushâ, and follow the dialog
Sending push notifications from Bubble:
- Install any OneSignal Bubble Plugin to your app. We recommend this free one here: https://bubble.io/plugin/onesignal-1550111582496x405806558737334300.
- Use the âOneSignal - Send push notification by Player IDsâ workflow (see the note regarding saving the player ID above).
Here is how to set it up:
â ď¸Â Please make sure you are using the IAP & Push version of the Henry Thunkable template
The first thing you need to do is to set up your app listings in App Store Connect (iOS) and the Google Play Developer Console (Android). You can find the respective guides in Thunkableâs documentation (you donât have to upload a build or publish your app yet):
Next, you need to establish a set of product IDs AppStore Connect and / or Google Play Console
- iOS: See steps here for more information: https://academy.thunkable.com/in-app-purchases/overview/ios-app-store-setup
- Android: See steps 1-2 here for more information: https://academy.thunkable.com/in-app-purchases/overview/android-play-store-setup
- Follow the steps outlined in Thunkable docs â Publish to App Store (iOS) to send a build of your app to your AppStore Connect account. You donât have to do the âNext Steps - App Store Connectâ part yet.
- Submit your app to TestFlight (see https://academy.thunkable.com/in-app-purchases/overview/ios-app-store-setup#dev7e89e149d for how to)
- Add yourself as a tester using a testing group
- Install the TestFlight app from the AppStore on your phone
- Open the TestFlight app and download your app
- Donât forget to upload a screen shot under review information (size 640 x 920). For testing purposes you can just use a random app screen shot of that size. Eg this one here.
- Follow the steps outlined in https://docs.thunkable.com/publish-to-play-store-android. You donât have to submit your app yet. However, even for internal testing, you will need to upload screenshots. You should be able to use any image file with the correct dimensions for now.
- Then use âInternal Testingâ to download a version of your app to your phone.
Once all of the above is set up, you can use the Henry plugin in Bubble to trigger In-App-Purchases for subscriptions or items:
- Put the Henry plugin element âHenry:In-App-Purchasesâ on the page
- Use the elementâs workflow actions âPurchase Subscriptionâ or âPurchase Itemâ to trigger purchases
- After triggering the workflow in step 2, the user will be prompted to buy an item. You will need to listen to the response for the transaction by adding two events to your workflow section:
- âHenry:In-App-Purchases A An item or subscription is purchased successfullyâ. In case of a successful transaction, itâs important to save the transaction receipt to Bubbleâs database, so you later know that a users has purchased and item or subscription. We recommend to create a data type âpurchaseâ for this and add the following fields (see picture):
- âHenry:In-App-Purchases A The transaction had an errorâ. In case the transaction is not concluded successfully, the element will trigger an error event. E.g. if the user cancels the transaction. You donât necessarily have to do anything with this information, but it can be useful to prompt the user to try again etc.
For Android, when a user initiates a transaction, it must be completed by acknowledging the purchase. This acknowledgement communicates to Google Play that you have granted entitlement for the purchase and completes the transaction. If you fail to complete this acknowledgement step your subscriptions will revert in a period of 3 days from the time of purchase.
- First, you need to set up a Google Service Account and generate an access key. This will be used below to authenticate your app with the Google Play API. You can follow the instructions outlined in: https://thenicholasrbarrowcompany.gitbook.io/bubble-plugins/google-service-account/google-service-account-plugin/prerequisites. If you need more details on how to set up the Service Account, see here: https://academy.thunkable.com/in-app-purchases/overview/android-play-store-setup#step-4-setup-your-google-cloud-account-and-android-service-account. However, in the last step, please select P12 instead of JSON and then go back to the last step in https://thenicholasrbarrowcompany.gitbook.io/bubble-plugins/google-service-account/google-service-account-plugin/prerequisites to generate your private key.
- Install the free Google Service Account plugin to your Bubble app.
- Use the below sequence of workflows to Authenticate with the Google Play API and acknowledge the purchase:
- Service Account Email: The email account associated with your service account.
- Scope: https://www.googleapis.com/auth/androidpublisher
- Email to Impersonate: Email address the service account should perform actions on behalf of; usually a super-admin in your Google organization.
- key: They key downloaded from the .PEM file in step 1 above. The same key is reusable.
- Takes the result of the previous step as inpt
- token: the purchase token you have saved when the user purchased the item
- Authorization: Write the word âBearerâ plus an empty space and then add the temporary access token generated in the step above.
- If the acknowledgement is successful, the API will not return any value.
Validating purchase receipts
Sometimes itsâ necessary to validate an earlier purchase. E.g. to check if a subscription is still valid or if it has been cancelled and expired. While this is pretty straight forward for iOS, its a bit more complicated for Android. Here is how itâs done:
- Follow the steps outlined in https://academy.thunkable.com/in-app-purchases/overview/ios-app-store-setup#create-an-app-password to create an app-specific password.
- In-app-purchases - Validate iOS receipt workflow to validate the receipt.
- In-app-purchases (testing) - Validate iOS receipt (Sandbox URL): Used for testing (e.g. in TestFlight)
- In-app-purchases (testing) - Validate iOS receipt (Production URL): Used in production mode (e.g. for your actual live client subscriptions)
This workflow step will return an object with information about the purchase that you are validating. You can use this information e.g. to make changes to the user and grant them premium features. You can find more information on how to interpret the return data here https://developer.apple.com/documentation/appstorereceipts/responsebody or here https://academy.thunkable.com/in-app-purchases/overview/verify-ios-purchases#:~:text=Learn more about the data this API call returns
- First, you need to set up a Google Service Account and generate an access key. This will be used below to authenticate your app with the Google Play API. You can follow the instructions outlined in: https://thenicholasrbarrowcompany.gitbook.io/bubble-plugins/google-service-account/google-service-account-plugin/prerequisites. If you need more details on how to set up the Service Account, see here: https://academy.thunkable.com/in-app-purchases/overview/android-play-store-setup#step-4-setup-your-google-cloud-account-and-android-service-account. However, in the last step, please select P12 instead of JSON and then go back to the last step in https://thenicholasrbarrowcompany.gitbook.io/bubble-plugins/google-service-account/google-service-account-plugin/prerequisites to generate your private key.
- Install the free Google Service Account plugin to your Bubble app.
- Use the below sequence of workflows to Authenticate with the Google Play API and acknowledge the purchase:
- Service Account Email: The email account associated with your service account.
- Scope: https://www.googleapis.com/auth/androidpublisher
- Email to Impersonate: Email address the service account should perform actions on behalf of; usually a super-admin in your Google organization.
- key: They key downloaded from the .PEM file in step 1 above. The same key is reusable.
- Takes the result of the previous step as inpt
- token: the purchase token you have saved when the user purchased the item
- Authorization: Write the word âBearerâ plus an empty space and then add the temporary access token generated in the step above.
- This workflow step will return an object with information about the purchase that you are validating. You can use this information e.g. to make changes to the user and grant them premium features. You can find more information on how to interpret the return data https://adapty.io/blog/android-in-app-purchases-part-5-server-side-purchase-validation#:~:text=Subscription transaction or here https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions
URLs and sharing
Use the workflow action âHenry: Open URL in appâ to open a URL in the app in modal.
Use the workflow action âHenry: Open URL in browserâ to open a URL on the phoneâs default browser.
Use the workflow action âHenry: Trigger shareâ to trigger a native share dialog.
Play / display media
Henry comes with a built-in audio player. Use the workflow action âHenry: Play audioâ to play an audio file from a URL ending in .mp3
, .wav
, etc.
The URL can also point to the URL of a file stored in the appâs data base. Please make sure you use the thingâs fileâs URL, e.g.
Besides playing an audio file, you also have the following actions available:
- Henry: Pause audio
- Henry: Resume audio
- Henry: Stop audio
Henry comes with a built-in PDF viewer. Use the workflow action âHenry: View PDF in appâ to display a PDF from a URL ending in .pdf
.
The URL can also point to the URL of a file stored in the appâs data base. Please make sure you use the thingâs fileâs URL, e.g.
Henry comes with a built-in video player. Use the workflow action âHenry: Play video in appâ to play a video from a URL ending in .mp4
, .mov, etc.
.
The File URL can also point to the URL of a file stored in the appâs data base. Please make sure you use the thingâs fileâs URL, e.g.
Henry comes with a built-in image viewer Use the workflow action âHenry: View image in appâ to view an image from a URL ending in .jpeg, etc.
.
The File URL can also point to the URL of a file stored in the appâs data base. Please make sure you use the thingâs fileâs URL, e.g.
Select / record media
- Place the âHenry: Barcode scannerâ element on the page
- Use the âScan barcodeâ workflow action to open the camera to scan a barcode.
- If the user scans a barcode, an event âBarcode is scannedâ is triggered. You can use this event to create a workflow. E.g. if user confirms event with Event ID âscan1â, do something.
- Place the âHenry: Video recorderâ element on the page
- Use the âRecord videoâ workflow action to open the camera and start recording.
- Once the user clicks on âStopâ, the recording is stopped, the video is sent back to Bubble, and an event Video is recordedâ is triggered. You can use this event to create a workflow. E.g. if user confirms event with Event ID âvideo1â, do something.
â ď¸Â Make sure to use this workflow to save the video file in a new thing. â ď¸Â IMPORTANT: Make sure to add the â:saved to S3â option. This make sure that the actual video file is saved on AWS. Otherwise Bubble will just save the link to Thunkableâs temporary storage and you will likely lose your file.
- Place the âHenry: Audio recorderâ element on the page
- Use the âStart audio recordingâ workflow action to start an audio recording. The recording will start in the background, without any visual cues.
- Use the âStop audio recordingâ workflow action to stop an audio recording. The recorded audio file is then sent back to Bubble, and an event âAudio is recordedâ is triggered. You can use this event to create a workflow. E.g. if user confirms event with Event ID âaudio1â, do something.
â ď¸Â Make sure to use this workflow to save the video file in a new thing. â ď¸Â IMPORTANT: Make sure to add the â:saved to S3â option. This make sure that the actual video file is saved on AWS. Otherwise Bubble will just save the link to Thunkableâs temporary storage and you will likely lose your file.
- Place the âHenry: Camera and Libraryâ element on the page
- Use the âGet image from cameraâ or âGet image from photo libraryâ workflow action to prompt the user to take or select a photo.
- Once the user has selected or taken a photo, the image is sent back to Bubble, and an event âAn image is captured / selectedâ is triggered. You can use this event to create a workflow. E.g. if user confirms event with Event ID âcamera1â, do something. Make sure to use this workflow to save the image file in a new thing.
â ď¸Â IMPORTANT: Make sure to add the â:saved to S3â option. This make sure that the actual file is saved on AWS. Otherwise Bubble will just save the link to Thunkableâs temporary storage and you will likely lose your file.