Skip to main content
Native Plugins & Integrations1 min read

Haptics and Shake Gesture

Trigger native vibration feedback from your website and react when the user shakes the phone, with supported styles for iOS and Android.

Overview

The Haptics plugin lets your website trigger native vibration feedback, and tells your page when the user shakes the phone. Turn it on in Integrations › Native plugins and build a new version.

Vibrate

javascript
// A light tap, for example when an item is added to the cart
wapp.haptics.trigger({ style: 'impactLight' });

// Feedback after a form is sent
await wapp.haptics.trigger({ style: 'notificationSuccess' });
StyleiPhoneAndroid
impactLight, impactMedium, impactHeavy, impactSoft, impactRigid✓✓
notificationSuccess, notificationWarning, notificationError✓✓
selection✓✓
tick, click, double_click, long_press, reject, confirmno vibration, returns supported: false✓

The result is { success: true, supported: true | false }. Users who turned off system haptics feel nothing, but the call still succeeds.

Shake

  1. Turn on Detect device shake in the plugin settings (no new build needed).
  2. Listen for the event:
javascript
wapp.on('device_shake', () => openFeedbackForm());
// or
window.addEventListener('wapp:device_shake', () => openFeedbackForm());
// or a global function
function wapp_device_shake() { openFeedbackForm(); }

Shake sensitivity (low, medium, high) controls how hard the phone must be shaken. One shake fires one event. The motion sensor is read only while the app is open and needs no permission prompt.

Without JavaScript

html
<a href="wapp://haptics/trigger?params=%7B%22style%22%3A%22impactHeavy%22%7D">Buzz</a>

See URL protocol.

Tips

Use haptics to confirm something the user did, not for decoration.

Next steps