swiftxcodereact-nativesirikitsirishortcuts

Call the SiriKit API to create Automation Shortcuts


I am using react-native-siri-shortcut and have successfully created a "Shortcut", however, it seems that it's only a shortcut that takes the user back to my App.

I've started using Swift 5 and XCode 13.2, so happy to receive answers using these languages too.

What I'm trying to do is allow them to create Automation shortcuts from within the app, whether it be "Open this app at 5pm every day" or something similar.

Is it possible to call the API to create Shortcut Automations? Is there another way, that doesn't use react-native-siri-shortcut?

Any help is greatly appreciated, thank you!


Solution

  • Interacting with apples Shortcut app:


    Things worth mentioning when working with shortcut automations:


    In app automations (IOS):
    You can use Background Tasks, BGTaskScheduler, UserNotifications (APNS) etc. to automate things from within your app.


    In app automations (MacOS):

    On macOS you can easily automate things using crontab - when the user is logged in - or launchctl if you want to be more fexible (attention for daemons are root permissions required!)


    Notice: Any kind of automation can cause security issues if it can run without user interactions, especially if it has root privileges.


    Links according to this topic/answer: