How to make the phone vibrate

Hey all, I’m new to JavaScript

Is there a way to make the phone vibrate using scriptable?

I’ve not seen anything in the documentation, but in a pinch, you could x-callback-url out to Shortcuts and use a shortcut to vibrate the phone. If you have vibrations on for notifications, maybe it would be sufficient just to push a notification?

Thanks, problem is I’m completely unfamiliar with x-callbacks

Great opportunity to learn :wink:

Basic principle would be to switch this around and apply the details in this section of the Shortcuts user guide.

You can Google (other search engines are available) x-callback-url and find lots of info about the general principles.

Any specific questions, just post back with them :grinning:

Thank you @sylumer !
Learnt and done!


var alert = new Alert()
alert.title = "Minutes"
alert.addAction("OK")
alert.addCancelAction("Cancel")
alert.addTextField("","5")
await alert.present()
var interval = alert.textFieldValue(0)
	console.log(interval)
function vibe() {
var sc = "shortcuts://x-callback-url/run-shortcut?name=vibrate"
Safari.open(sc)
}


var t = new Timer()
t.timeInterval = parseInt(interval) * 60000
console.log(t.timeInterval)
t.schedule(vibe)

2 Likes