skip to Main Content

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!

2

Answers


  1. Siri shortcut api is provided to developers so that they could provide their apps main functionality to the system (siri , shortcut).

    if you want to create an automation app i have some other suggestions for automating different tasks:

    Automation tasks that needs permission:

    these are tasks that iOS won’t delegate to your app like opening an app on schedule.
    a way to go around this is using your apps deep link or other apps that provide a deep link and set a local notification or push notification with that link. when you click on the notification your app opens up if the link is yours you are done if not you call the deep link and other apps will open. problem with this approach is callbacks and getting notified when the job is done and you have to fire the next task.

    these are some ios system URL schemes and they are available for other apps as well. They usually mention the schemes in their websites.

    https://github.com/phynet/iOS-URL-Schemes

    Location based automation services:

    you could use geofencing capability and mix it with push notification or local notification and continue the rest of the tasks in your app when your user is in his marked location. take a look at

    https://www.raywenderlich.com/17649843-geofencing-with-core-location-getting-started

    Timebase automation services:

    time-based automations could be achieved by background tasks and if you could provide server-side they could also be achieved by push notifications.

    Complex multistep automation services:

    for this purpose, you could use some open-source automation available and implement their APIs in your app like n8n

    https://n8n.io

    and on each step of the workflow notify your app so as the main interface of the automation it could show the current step.

    these are just some suggestions based on possible workarounds.

    Login or Signup to reply.
  2. Interacting with apples Shortcut app:

    • use deep linking to allow users to open the shortcuts app, open a single shortcut or run a specific shortcut.

    • provide a shortcut for your app that then can be used within the ShortCut app like: MyApp – show me the latest news from "selected blog"

    Things worth mentioning when working with shortcut automations:

    • automations require special permissions to run without user interaction

    • many automations won’t run if the device is locked

    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:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search