Skip to content

Commit 4c831cc

Browse files
Update apps.md
1 parent 53e4b3c commit 4c831cc

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

docs/apps.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Documentation for apps. If you'd like to make an app [check out this guide](/doc
1313
* [Delete app](#delete-app)
1414
* [Finding more apps](#finding-apps)
1515
* [Testing apps](#testing-apps)
16+
* [Running apps programmatically](#running-apps-programmatically)
1617
* [Downloading apps](#downloading-apps)
1718
* [Importing apps](#importing-apps)
1819
* [Publishing apps](#publishing-apps)
@@ -91,6 +92,121 @@ After you've found a public or private app on [https://shuffler.io](https://shuf
9192

9293
![Apps view search 16](https://github.com/Shuffle/shuffle-docs/blob/master/assets/searchengine_app.png?raw=true)
9394

95+
## Running Apps Programmatically
96+
The `run_app()` function in the Shuffle Python SDK (shufflepy) lets you trigger and test any Shuffle app action directly from Python. It works the same way as running an action inside a workflow, making it perfect for quick testing, debugging, or running apps outside the Shuffle UI.
97+
98+
Here’s what a simple call looks like:
99+
```python
100+
response = shuffle.run_app(
101+
app_id="YOUR_APP_ID",
102+
action="YOUR_ACTION_NAME",
103+
auth="YOUR_AUTH_ID",
104+
params={ "param_name": "value_here" }
105+
)
106+
print(response)
107+
```
108+
109+
That’s it. Shuffle takes care of the rest, URL handling, request sending, authentication, all of it.
110+
111+
**Finding app_id, auth, and Required Params**:
112+
113+
If you’re wondering where to get these values
114+
115+
* app_id → Go to /apps, find the app, and click it.
116+
You’ll see a link icon that leads to something like /apps/fb715a176a192687e95e9d162186c97f.
117+
The last part of the URL (fb715a176a192687e95e9d162186c97f) is your app ID.
118+
119+
* auth → If you already authenticated the app, then you don't have to provide the auth again here. You can leave it as "", but just in case it doesn’t work, go to `/admin?tab=app_auth`, find the app’s authentication entry, and copy the Auth ID.
120+
121+
* params → These are the same as the input fields you see when you drag the app’s action into a workflow.
122+
The parameter names in Python have to match exactly what you see in the UI, but in a lowercase.
123+
124+
**Basic Example – Shuffle Tools App**
125+
The Shuffle Tools app comes with a simple action called Repeat back to me, which just returns whatever you send. It’s perfect for testing.
126+
127+
```python
128+
response = shuffle.run_app(
129+
app_id="3e2bdf9d5069fe3f4746c29d68785a6a",
130+
action="repeat_back_to_me",
131+
auth="",
132+
params={
133+
"call": "hiii"
134+
}
135+
)
136+
print(response)
137+
```
138+
This will just return the text you passed in `call`.
139+
140+
**Sample Output**
141+
142+
```json
143+
{
144+
"success": true,
145+
"result": "hiii",
146+
"id": "1fdf8549-9a96-4d6f-d4fd-lay2345658be6",
147+
"authorization": "2df453c0-1df9-4bdf-8822-XXXXXXX",
148+
"errors": [],
149+
}
150+
```
151+
152+
**Example with Path Parameters – IPInfo App**:
153+
154+
Now let’s look at a more realistic example using the IPInfo app.
155+
This app has an endpoint like:
156+
157+
```bash
158+
https://ipinfo.io/{ip}/geo
159+
```
160+
161+
In Shuffle, whenever you build an app where an action has a path param like `{param}` in the URL, Shuffle will automatically detect this and include it as a required param for the action.
162+
163+
```python
164+
response = shuffle.run_app(
165+
app_id="3cdebb07c300e4e60242a0ef5ae284e7",
166+
action="get_ip_geo_info",
167+
auth="a8d1db04-2dd5-496f-a441-3efc4dxxxxxx",
168+
params={
169+
"url": "https://ipinfo.io",
170+
"ip": "8.8.8.8"
171+
}
172+
)
173+
print(response)
174+
```
175+
176+
Here, the params like `url` and `ip` are required by the action. You can easily know what params an app needs by clicking on it in the workflow editor and selecting the action.
177+
178+
**Query Parameters (like ?foo=bar)**
179+
If your action uses query parameters (for example /api/data?limit=10&sort=desc), just pass them as a string in "queries":
180+
181+
```python
182+
params={
183+
"queries": "limit=10&sort=desc"
184+
}
185+
```
186+
187+
You can also mix both path and query params together if the action uses both. For example:
188+
189+
```python
190+
response = shuffle.run_app(
191+
app_id="example_app_id",
192+
action="get_device_logs",
193+
auth="auth_id",
194+
params={
195+
"deviceId": "abc123",
196+
"queries": "limit=10&sort=desc"
197+
}
198+
)
199+
200+
```
201+
202+
That call becomes:
203+
204+
```bash
205+
/device/abc123/logs?limit=10&sort=desc
206+
```
207+
208+
That’s pretty much it. Once you get the hang of it, shuffle.run_app() is a quick and reliable way to test or trigger any app directly from Python.
209+
94210
## Downloading apps
95211
Apps can be downloaded or exported from your local instance or [https://shuffler.io](https://shuffler.io) as long as it's either your private app, or a public one AND is OpenAPI. If you find the "download" icon in any part of Shuffle, that means the item is exportable.
96212

0 commit comments

Comments
 (0)