iPhone Shortcut, NFC and foqos
uLockin’s phone trigger lets an iPhone Shortcut start or stop a session in the uLockin tab open on your computer. Put the Shortcut behind an NFC tag and one tap does it.
It pairs well with foqos, which blocks distracting apps through iPhone Screen Time. One tap starts foqos on the phone and a uLockin session on the desktop. The next tap stops both.
What you need
Section titled “What you need”- uLockin open in a browser tab on your computer.
- An iPhone with the Shortcuts app.
- Optional: an NFC tag or card, and foqos.
The Shortcut makes a background web request, so nothing opens on the phone. The timer runs in the desktop tab.
1. Make a secret in uLockin
Section titled “1. Make a secret in uLockin”-
On your computer, open ulockin.com and open Settings.
-
Under Phone trigger, press Make a secret.
-
The section now shows Connected and four values, each with a Copy button:
Value Example Secret 43 letters, digits, -and_Start URL https://ulockin.com/api/trigger/start?work=40&break=15Stop URL https://ulockin.com/api/trigger/stopAuthorization header Bearerfollowed by your secret
You’ll type or paste the two URLs and the Authorization header into the Shortcut. If your Mac and iPhone share an Apple Account, copy on the Mac and paste on the iPhone. Otherwise send them to yourself in a note.
2. Build a start Shortcut
Section titled “2. Build a start Shortcut”-
In the Shortcuts app, make a new shortcut and add the Get Contents of URL action.
-
Set the URL to your Start URL. Change
workandbreakto the minutes you want. -
Open the action’s options and set Method to POST.
-
Under Headers, add a header. The key is
Authorization. The value is your Authorization header value, starting withBearer. -
Optional: add Show Notification and give it the Contents of URL. uLockin answers with one sentence, such as “Start sent to 1 uLockin tab.”
Run the shortcut. The uLockin tab on your computer starts a work session.
A stop Shortcut is the same with the Stop URL. It has no work or break.
3. Pair it with foqos
Section titled “3. Pair it with foqos”foqos adds its own Shortcuts actions, among them Start Foqos Profile, Stop Foqos Profile and Check if Foqos Session is Active. Use them to make one Shortcut that toggles:
-
Add Check if Foqos Session is Active.
-
Add an If action on its result.
-
In the If branch (a session is active), add Stop Foqos Profile, then Get Contents of URL with your Stop URL.
-
In the Otherwise branch, add Start Foqos Profile, then Get Contents of URL with your Start URL.
-
Set Method to POST and add the
Authorizationheader on both URL actions, as in step 2 above.
Start foqos with no duration. Then the stop tap, not a timer on the phone, is what unlocks your apps, and uLockin starts your break at that same moment.
4. Put it on an NFC tag
Section titled “4. Put it on an NFC tag”-
In the Shortcuts app, open Automation and make a new automation.
-
Choose NFC, scan your tag and give it a name.
-
Choose Run Immediately, so the tap doesn’t ask for confirmation.
-
Pick the Shortcut you built.
You can make several tags with different timings. For example, one Shortcut with work=40&break=15 for deep work and another with work=15&break=5 for small tasks, each behind its own tag.
How taps behave
Section titled “How taps behave”A start tap
- Begins a work session with the tag’s
workminutes. The tag’sbreakis used for the break right after it. - The tag’s lengths apply to that one cycle. Your preset doesn’t change.
- While work is already running or paused, it changes nothing.
- During a break, it ends the break and begins work.
A stop tap
- During work, it ends the session now. The minutes you actually worked are logged, the sheet asks what you got done, and your break starts under it.
- During a break, it starts that break over from the tap.
- On work that ran for under a minute, it drops the session as a mistaken tap. Nothing is logged.
After a tag’s break ends, the next work session waits for Start or the next tap.
If no uLockin tab is open, the call is held for up to 8 hours. When you open uLockin, it applies the call from the time you tapped, so the timer stays in step with foqos. A held start is dropped once its work time has already passed.
Use the same secret in another browser
Section titled “Use the same secret in another browser”Each browser that has the secret listens. To add a second computer, copy the Secret from Settings, open uLockin’s Settings there and paste it into Or paste a secret from another browser.
The secret is never part of an export file.
If something goes wrong
Section titled “If something goes wrong”Add the Show Notification step to see uLockin’s reply.
| Reply | What to do |
|---|---|
| Start held: no uLockin tab is connected. | Open uLockin on your computer. The call applies when it connects. |
| No uLockin has connected with this secret. | The secret in the Shortcut doesn’t match one in Settings. Copy the Authorization header again. |
| Missing or malformed secret. | The header’s key must be Authorization and its value Bearer, a space, then the secret. |
| This secret was replaced. | A new secret was made. Copy the new header into your Shortcuts. |
| Use POST. | Set the action’s Method to POST. |
| work must be whole minutes from 1 to 240. | Fix the work or break number in the URL. |
For every reply and status code, see the Trigger API.