I need to have a dynamic parameter for Shortcuts, so a person can say something like
Hey Siri, order a pizza with
The parameter code in the appIntent is
@Parameter(title: "Title")
var itemName: String
In the Shortcut I use:
AppShortcut(
intent: NewItemIntent(),
phrases: [
"order \(\.$itemName) using \(.applicationName)"
],
shortTitle: "Order Item",
systemImageName: "sparkles"
)
When I call it "hey Siri, order pizza using ***" where pizza should be passed via the parameter then handed off to the appintent. However, it ignores the spoken parameter in lieu of putting up a dialog asking "What's the name?" I can say "pizza" and it now works. How can I pick up the parameter without having to go to that second step as the code implies?
Shortcuts
RSS for tagHelp users quickly accomplish tasks related to your app with their voice or with a tap with the Shortcuts API.
Posts under Shortcuts tag
109 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I’ve created several shortcuts that tell me the stock price of a given company. The shortcut queries Yahoo Finance using Get Contents of URL, with the URL
https://finance.yahoo.com/quote/TICKER SYMBOL/, for example
https://finance.yahoo.com/quote/PLTR/ for Palantir or
https://finance.yahoo.com/quote/AAPL/ for Apple, etc.
Then it uses RegEx to parse out the numbers which it then formats and displays in a notification. Simple. It works great for several stocks, but for some reason, it does not work correctly for Palantir. It shows an older “previous close” price. Oddly, when I go to the website myself, it shows me the current stock price.
So for today Mar 21 https://finance.yahoo.com/quote/PLTR/ shows me $90.96 (correct) but the shortcut, via Get Contents of URL, shows $87.39 (incorrect). This $87.39 price is listed further down in the page as a "previous close” price. I don’t get it.
Here is a link to my Palantir shortcut:
https://www.icloud.com/shortcuts/edea6ee0261245f49b078efc74d632dd
Here is a link to my Apple shortcut:
https://www.icloud.com/shortcuts/54a416393203432aa356fe76373e3f8b
So the question is, why does Get Contents of URL show an old stock price but when I go to the site myself, it shows the correct stock price … and only for Palantir? I have about six shortcuts running correctly. Palantir is the only one that does not work.
Been banging my head on this one for weeks. Any advice would be much appreciated.
Thank you,
Rob
I have an AppIntent in one of my applications, which shows up in Shortcuts. I would like to run this intent/shortcut from my other application without jumping to Shortcuts with a deeplink. Is this possible?
I made a set of Siri Shortcuts in my app with the AppShortcutsProvider, and they each have a set of phrases.
I can activate the shortcuts via Siri phrases or Spotlight search on iOS 18+, but not on iOS -17.
I've checked the documentation and see that AppShortcutsProvider is supported from iOS 16+, so I don't understand why I can't view the shortcuts in Spotlight or activate them with Siri unless it's at least iOS 18.
Any thoughts?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Spotlight
Siri and Voice
Shortcuts
App Intents
I'll ask Siri: What is the weather?"
and will get a valid response
I'll ask Siri to execute a shortcut my app has created
I get "what is the order?" (a phrase nowhere in my app)
I'll repeat the question about the weather
I now get "what is the order?"
***?
I’m trying to group my EntityPropertyQuery selection into sections as well as making it searchable.
I know that the EntityStringQuery is used to perform the text search via entities(matching string: String). That works well enough and results in this modal:
Though, when I’m using a DynamicOptionsProvider to section my EntityPropertyQuery, it doesn’t allow for searching anymore and simply opens the sectioned list in a menu like so:
How can I combine both? I’ve seen it in other apps, but can’t figure out why my code doesn’t allow to section the results and make it searchable? Any ideas?
My code (simplified)
struct MyIntent: AppIntent {
@Parameter(title: "Meter"),
optionsProvider: MyOptionsProvider())
var meter: MyIntentEntity?
// …
struct MyOptionsProvider: DynamicOptionsProvider {
func results() async throws -> ItemCollection<MyIntentEntity> {
// Get All Data
let allData = try IntentsDataHandler.shared.getEntities()
// Create Arrays for Sections
let fooEntities = allData.filter { $0.type == .foo }
let barEntities = allData.filter { $0.type == .bar }
return ItemCollection(sections: [
ItemSection("Foo",
items: fooEntities),
ItemSection("Bar",
items: barEntities)
])
}
}
struct MeterIntentQuery: EntityStringQuery {
// entities(for identifiers: [UUID]) and suggestedEntities() functions
func entities(matching string: String) async throws -> [MyIntentEntity] {
// Fetch All Data
let allData = try IntentsDataHandler.shared.getEntities()
// Filter Data by String
let matchingData = allData.filter { data in
return data.title.localizedCaseInsensitiveContains(string))
}
return matchingData
}
}
I'm currently trying to use the new @UnionValue macro.
From what I understood, it allows multiple types for a parameter.
I created the following enum:
@UnionValue
enum IntentDuration {
case int(Int)
case duration(Measurement<UnitDuration>)
}
Then, I tried to use it in the following AppIntent:
struct MyIntent: AppIntent {
static let title: LocalizedStringResource = "intent.title"
static let description = IntentDescription("intent.description")
static let openAppWhenRun: Bool = true
@Parameter var duration: IntentDuration
@Dependency
private var appManager: AppManager
@MainActor
func perform() async throws -> some IntentResult {
// My action
return .result()
}
}
However, I get the following error from Xcode at the @Parameter line:
'init()' is unavailable
Did I wrongly understand how this works? Is there another way to accept multiple types for a parameter?
I didn't manage to find any docs on this.
hi so im trying to create a simple app that has two pressable buttons that turn a spa mode on and off wishing another app
so far I have the UI figured out the app works the only issue is right now when I press spa on I have setup so it opens Siri Shortcuts and enables the shortcut is there a way to make the app revert back to mine after the action is done? or is there another way to open the other app and navigate to the button within that app and enable it behind my app
So Recently I’ve been making shortcuts and I noticed that I can prompt chatgpt with shortcuts to add extra functionality, I like this idea but there is 1 flaw with it and that is there is no ability to remove chats automatically, I suppose this would be fine except every time the shortcut is run it creates a new chat, usually I would have made it to remove the chat after the shortcut is finished, but since I can’t the chats would pile up as there is no way of getting rid of them automatically and it would be tedious to manually delete all the chats.
also sorry if I chose the wrong topic and subtopic, I couldn’t find a topic about shortcuts
Hello everyone,
I’m currently developing a Playground App for the Swift Student Challenge, and its core functionality relies heavily on Shortcuts Automation, App Shortcuts, and interactions with the Focus Mode status (e.g., reading Focus Status or execute Focus Filter).
Before finalizing my submission, I’d like to clarify whether these features will function as expected during the review process. Specifically:
Shortcuts Automation: My app uses custom shortcuts to trigger actions within the Playground. Will reviewers be able to test these shortcuts seamlessly, or do I need to provide explicit instructions for enabling/setting them up?
App Shortcuts: The app integrates system-level App Shortcuts (via App Intents). Are these supported in the test environment, and will reviewers see them during testing?
Focus Status Interaction: The app dynamically responds to changes in the device’s Focus Mode (e.g., adjusting UI and function based on FocusStatus). Does the evaluation environment allow access to Focus Status data, and are there restrictions on simulating Focus Mode changes?
I want to ensure these features are testable and don’t lead to unexpected issues during review. Any insights or advice from past participants, mentors, or Apple experts would be greatly appreciated!
Thank you in advance for your guidance!
Topic:
Community
SubTopic:
Swift Student Challenge
Tags:
Swift Student Challenge
Shortcuts
App Intents
Focus
(Public dupe of FB16477656)
The Shortcuts app allows you to parameterise the input for an action using variables or allowing "Ask every time". This option DOES NOT show when conforming my AppEntity.defaultQuery Struct to EntityStringQuery:
But it DOES shows when confirming to EntityQuery:
As discussed on this forum post (or FB13253161) my AppEntity.defaultQuery HAS TO confirm to EntityStringQuery to allow for searching by String from Siri Voice input.
To summarise:
With EntityQuery:
My Intent looks like it supports variables via the Shortcuts app. But will end up in an endless loop because there is no entities(matching string: String) function.
This will allow me to choose an item via the Shorcuts.app UI
With EntityStringQuery:
My Intent does not support variables via the Shortcuts app.
I am not allows to choose an item via the Shorcuts.app UI.
Even weirder, if i set up the shortcut with using a build with EntityQuery and then do another build with EntityStringQuery it works as expected.
Code:
/*
Works with Siri to find a match, doesn't show "Ask every time"
*/
public struct WidgetStationQuery: EntityStringQuery {
public init() { }
public func entities(matching string: String) async throws -> [Station] {
let stations = [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
return stations.filter { $0.id.lowercased() == string.lowercased() }
}
public func entities(for identifiers: [Station.ID]) async throws -> [Station] {
let stations = [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
return stations.filter { identifiers.contains($0.id.lowercased()) }
}
public func suggestedEntities() async throws -> [Station] {
return [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
}
public func defaultResult() async -> Station? {
try? await suggestedEntities().first
}
}
/*
DOES NOT work with Siri to find a match, but Shortcuts shows "Ask every time"
*/
public struct WidgetBrokenStationQuery: EntityQuery {
public init() { }
public func entities(matching string: String) async throws -> [Station] {
let stations = [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
return stations.filter { $0.id.lowercased() == string.lowercased() }
}
public func entities(for identifiers: [Station.ID]) async throws -> [Station] {
let stations = [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
return stations.filter { identifiers.contains($0.id.lowercased()) }
}
public func suggestedEntities() async throws -> [Station] {
return [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
}
public func defaultResult() async -> Station? {
try? await suggestedEntities().first
}
}```
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
Shortcuts
Intents
App Intents
I'm currently working on an AppIntent in my app to import Apple Pay transactions via Transaction triggers in Shortcuts. While I can access the transaction name with the following code:
@Parameter(title: "Transaction")
var transaction: String
I'm not sure how to retrieve the full details of the transaction, including:
Card or Pass
Merchant
Amount
Name
At the moment, transaction only provides the name as a string, but I need access to the complete transaction data. I know that by selecting specific fields like Amount, Merchant, etc., I can retrieve each piece of data individually, but it would be much easier and more user-friendly to simply retrieve the entire transaction object at once.
Has anyone successfully retrieved all details of an Apple Pay transaction in this context, and if so, could you share how to do so?
Topic:
App & System Services
SubTopic:
Apple Pay
Tags:
Shortcuts
Apple Pay
App Intents
Tap to Pay on iPhone
I am needing to add/delete shortcuts in our app without using the Add to Siri button. But have been stymied at every turn. The most recent example is some code that uses an "AppShortcutCenter" call, supposedly added in iOS 17. But there is no such thing as that which I can find. What gives, and what's needed to do custom shortcuts on demand programmatically?
I am currently facing an issue when trying to enable Shortcut support and would greatly appreciate your assistance in resolving it.
I have successfully enabled Shortcut support, and I can find my app and its respective functionalities within the Shortcuts app. However, I am unable to locate my app when attempting to create an automation within Shortcuts. I would appreciate any guidance or solutions you may offer regarding this matter.
Hi Devs,
I’ve created an app intent shortcut for our Best Buy app. This shortcut is visible on iOS 17.2 and later. However, I’ve marked it to support iOS 16+ as shown below:
import AppIntents
@available(iOS 16.0, *)
struct LaunchIntent: OpenIntent {
why we are not able to see shortcuts for iOS 16?
I've been exploring the Trails Sample App from this session at WWDC24.
The app has a TrailEntity of type AppEntity which is leveraged in multiple places throughout the app, including:
The GetTrailInfo App Intent with a trail parameter of type TrailEntity.
A parameterized App Shortcut which calls the GetTrailInfo intent.
The TrailDataManager's init calls updateSpotlightIndex(), which creates a CSSearchableItem for each Trail in the app, along with an associateAppEntity call linking the corresponding TrailEntity to each item that gets added to the CSSearchableIndex.
If you build the app and search "trails" in Spotlight, the Trails Sample App section includes instances of TrailEntity as search results. But if you comment out the App Shortcut that takes a TrailEntity as a parameter and rebuild, there are no instances of TrailEntity in the search results. In both cases, the console prints [Spotlight] Trails indexed by Spotlight.
Is this expected behavior? Why are the TrailEntity instances only appearing in Spotlight via the App Shortcut? Shouldn't the CSSearchableItem instances show up in Spotlight on their own regardless? If not, then what is the purpose of adopting Core Spotlight with App Entities? Does this add the app entities to the semantic index for "new Siri", even though they're not user facing in the Spotlight UI?
Topic:
App & System Services
SubTopic:
General
Tags:
Shortcuts
Core Spotlight
App Intents
Apple Intelligence
I have an App Intent that returns a MyEntity value with the following properties:
struct MyEntity: AppEntity {
@Property(title: "Title")
var title: String?
@Property(title: "Image")
var image: IntentFile?
}
I created a Shortcut that takes the output value of this intent and passes it as the input to the Send Message action. When I tap the MyEntity parameter in the message action, it shows to be of Type MyEntity. Below that, I can select 1 of 3 options: MyEntity, Title, or Image.
When I run the shortcut, a new message compose window appears with the following behavior depending on the selected option:
MyEntity - the message draft is empty
Title - the message draft shows the title string
Image - the message draft shows the image
My expected and desired result when MyEntity is selected would be a message draft populated with the image and the title string as text. How would I achieve this? Is it possible?
I've experimented with conforming MyEntity to Transferable. That's enabled use cases such as passing the MyEntity input as Type Image for example.
Do I need to create a custom UTType to represent MyEntity, or is that unrelated to my issue? I haven't explored this yet but seems potentially related!
Topic:
App & System Services
SubTopic:
General
Tags:
Shortcuts
Uniform Type Identifiers
App Intents
Core Transferable
I made a macOS document-based app that has a second scene that's a Window. It's name appears in the single window list of the Windows menu, but has no assigned shortcut. I've tried the following to assign a shortcut to it, but it doesn't add a "⌘L" as I want:
Window("Logs", id: "logs") {
LogsView()
}
.keyboardShortcut("l")
I can brute-force this using .commands to replace the menu item but that seems crude and unnecessary. Is it the only way?
Everytime i open the app shortcuts and go to text to speech when i press play the outcome is an evil laugh. What‘s happening? Is it a bug or? Im on ios 18.3
I have an image based app with albums, except in my app, albums are known as galleries.
When I tried to conform my existing OpenGalleryIntent with @AssistantIntent(schema: .photos.openAlbum), I had to change my existing gallery parameter to be called target in order to fit the predefined shape of this domain.
Previously, my intent was configured to display as “Open Gallery” with the description “Opens the selected Gallery” in the Shortcuts app. After conforming to the photos domain, it displays as “Open Album” with a description “Opens the Provided Album”.
Shortcuts is ignoring my configured title and description now. My code builds, but with the following build warnings:
Parameter argument title of a required Assistant schema intent parameter target should not be overridden
Implementation of the property title of an AppIntent conforming to AssistantSchemaIntent should not be overridden
Implementation of the property description of an AppIntent conforming to AssistantSchemaIntent should not be overridden
Is my only option to change the concept of a Gallery inside of my app into an Album? I don't want to do this... Conceptually, my app aligns well with this domain does, but I didn't consider that conforming to the shape of an AI schema intent would also dictate exactly how it's presented to the user.
FB16283840
Topic:
Machine Learning & AI
SubTopic:
Apple Intelligence
Tags:
Siri and Voice
Shortcuts
App Intents
Apple Intelligence