Prerequisites
-
A Webflow project integrated with Wized
-
A Despia project set up and published to TestFlight/Google Play (can be in draft)
-
The Despia app running on your test device via TestFlight
Clone the Example Projects
To get started quickly, you can clone the example projects:
-
Wized Project: Clone here
-
Webflow Project: Clone here
Overview
Despia allows your Webflow + Wized application to:
-
Be published as a native mobile app on App Store and Google Play Store
-
Access native device functionalities through simple JavaScript snippets
-
Implement features like contact access, push notifications, in-app purchases, and more
Implementation Steps
Set Up Permission Request Button
First, create a button in Webflow to request contact access permission:
-
Add a button element to your Webflow page
-
Label it "Request Contact Access"
-
Add a custom attribute:
-
Attribute name:
wized
-
Attribute value:
despia-request-contact-access
-
Configure Permission Request in Wized
-
Refresh the Wized canvas to detect the new button
-
In X-ray mode, click on the request button
-
Add a new action:
-
Event: On Click
-
Action Type: Run Function
-
Function code:
window.despia = "requestcontactpermission://"
-
Note:
window.despia
will show as undefined in the editor - this is normal as it's injected by the native Despia application.
Create Contact Reading Interface
Add elements to read and display contacts:
-
Add another button labeled "Read Contacts"
-
Add custom attribute:
-
Attribute name:
wized
-
Attribute value:
despia-read-contacts
-
-
Add a text element to display contact data (optional for testing):
- Add custom attribute:
wized
=contact-data-sample
- Add custom attribute:
Set Up Contact Storage Variable
In Wized, create a variable to store contacts:
-
Go to Variables tab
-
Create new variable:
-
Name:
contacts
-
Initial value:
[]
(empty array)
-
Configure Contact Reading Function
On the "Read Contacts" button, add an action:
-
Event: On Click
-
First Action - Run Function:
window.despia = "readcontacts://"
-
Second Action - Run Function (to handle the response):
function observeDespiaVariable(variableName, callback, timeout = 5000) { const startTime = Date.now(); function checkVariable() { if (window[variableName] !== undefined) { callback(window[variableName]); } else if (Date.now() - startTime < timeout) { setTimeout(checkVariable, 100); } else { console.error(`Despia timeout: ${variableName} was not set within ${timeout} ms`); } } checkVariable(); } observeDespiaVariable("contacts", function(contacts) { // Convert object to array format for Wized const result = Object.entries(contacts).map(([name, numbers]) => ({ name, number: numbers[0] })); // Set Wized Variable with Native Contact Data v.contacts = result; });
Display Contacts in a List
To render contacts as a list:
-
Create List Structure in Webflow:
-
Add a div container
-
Inside, add another div for the list item
-
Add two text elements inside the list item div (for name and number)
-
-
Add Wized Attributes:
-
On list item div:
wized
=contact-list-item
-
On name text:
wized
=contact-list-item-name
-
On number text:
wized
=contact-list-item-number
-
-
Configure List Rendering in Wized:
-
Create an iterator variable
i
with initial value0
-
On the list item element, set:
- List Value:
v.contacts
- List Value:
-
On the name text element:
- Text > Plain Text:
v.contacts[v.i].name
- Text > Plain Text:
-
On the number text element:
-
Text > Plain Text:
v.contacts[v.i].number
-
-
Important Considerations
Permission Handling
-
Users can grant full contact access or select specific contacts
-
If no permission is granted, the contacts array will be empty
-
Consider implementing fallback UI for when permission is denied
Privacy Features
-
Users can modify contact permissions in device settings anytime
-
Despia respects iOS/Android privacy guidelines
-
Users can choose to share only specific contacts with your app
Best Practices
-
Onboarding Flow: Request contact permission during user onboarding alongside other permissions
-
Error Handling: Check if contacts array is empty and guide users to settings if needed
-
Testing: Always test on real devices through TestFlight/Google Play beta
-
Real-time Updates: Changes in Wized are reflected immediately in your test app - just close and reopen through TestFlight
Testing Your Implementation
-
Publish your changes in Webflow
-
Publish in Wized
-
Open your app through TestFlight on your test device
-
Click "Request Contact Access" (permission dialog appears on first use)
-
Click "Read Contacts" to fetch and display contact data
Data Format
The contacts data returned by Despia follows this structure:
[
{
"name": "John Doe",
"number": "+1234567890"
},
{
"name": "Jane Smith",
"number": "+0987654321"
}
]
Sample Data for Testing
You can use this sample data in your Wized variables for testing the list rendering before connecting to real device contacts:
[
{
"name": "John Doe",
"number": "+1234567890"
},
{
"name": "Jane Smith",
"number": "+0987654321"
},
{
"name": "Apple Inc.",
"number": "+1-800-APL-CARE"
}
]
For additional support or questions, please contact our support team at support@despia.com