Appearance
Running scripts and tasks
Scripts (automations) are built in the AresLogin app with the block editor. From the API you run them, follow them and read what they saved. The AresLogin app must be open on the device that runs them.
Run a script on profiles
js
import { AresLogin } from 'areslogin';
const ares = new AresLogin({ apiKey: process.env.ARES_API_KEY });
const { data: scripts } = await ares.automations.list();
const run = await ares.automations.run(scripts[0].id, { profile_ids: ['40df428e', '9b1c22aa'], concurrency: 2 });
// run.run_id identifies this run. Poll it, or let the SDK wait:
const done = await ares.automations.runAndWait(scripts[0].id, { profile_ids: ['40df428e'] });
for (const p of done.data) console.log(p.profile_name, p.status, p.error);Each profile ends as done, failed or stopped. Stop a run with ares.automations.stop(id, run_id).
Read the results
Rows written by the Save result block:
js
const r = await ares.automations.results(scriptId); // newest 200 rows
// r.columns -> ['price', 'title']; r.data[0].values -> { price: '10', title: '...' }
const all = await ares.automations.results(scriptId, { all: true }); // up to 20,000 rowsTasks: which scripts, on which profiles, when
A task bundles one or more scripts with a list of profiles. A regular task runs when you ask; a scheduled task runs by itself at the times you give (Vietnam time, UTC+7).
js
const task = await ares.tasks.create({
name: 'daily-warmup',
profile_ids: ['40df428e', '9b1c22aa'],
automation_ids: [12, 15], // run in this order; order: 'random' shuffles them
schedule: { times: ['08:30', '20:00'], weekdays: [1, 2, 3, 4, 5] }, // omit for a regular task
});
const { task_run_id } = await ares.tasks.run(task.id); // queue a run now
const log = await ares.taskRuns.get(task_run_id); // status + every profileThings to know:
- One task at a time per device. A task started while another is running waits in that device's queue.
priority: truemoves it to the front; it does not interrupt the running task. - Scheduled tasks run on the device they were created for, so the app must be open there at run time. If it is closed, the run is logged as failed; it is not run later.
GET /task-runsis the log of every run; filter withstatus(queued,running,done,failed,stopped) andsearch.POST /task-runs/{id}/stopremoves a queued run from the queue, or asks a running one to stop.
What the API does not do
Building and editing scripts, uploading extensions, inviting members, changing the plan and topping up the wallet are done in the app. The wallet, orders and activity log are read-only over the API.