Use SocialCrawl with Airtable
Pull social media data into Airtable without writing a server.
You can pull SocialCrawl data into an Airtable base with an automation that runs a script. The script calls the API and returns the result to the next action. Setup takes three steps: add the input, paste the script, test the run.
Before you start
Create an API key in the dashboard under API Keys. In the script action, add it as an input variable named apiKey, not as text inside the code. Prove the key with a call that costs nothing:
curl "https://www.socialcrawl.dev/v1/credits/balance" \
-H "x-api-key: sc_your_key_here"A reply with "success": true and your balance in data.balance means the key works.
Connect
Add an automation with a Run script action. Under its input variables, add apiKey and handle. Paste this script:
const { apiKey, handle } = input.config();
const res = await fetch(
`https://www.socialcrawl.dev/v1/tiktok/profile/videos?handle=${encodeURIComponent(handle)}`,
{ headers: { "x-api-key": apiKey } }
);
const body = await res.json();
if (!body.success) {
output.set("status", res.status);
output.set("message", body.error.message);
output.set("checkout_url", body.error.details?.checkout_url ?? "");
} else {
output.set("status", 200);
output.set("count", body.data.items.length);
output.set("next_cursor", body.pagination?.next_cursor ?? "");
}Later actions can read each output.set value, for example to create a record or send a notification. Change the path to call any other endpoint.
Read the answer
Every response has the same shape. Branch on success. A list puts its rows in data.items, and pagination.next_cursor is the token for the next page.
{
"success": true,
"data": { "items": [{ "id": "7654638524729216287" }] },
"pagination": { "next_cursor": "sc.eyJ2Ijoy…", "has_more": true },
"credits_used": 1,
"credits_remaining": 99
}To read the next page, add &cursor= with the next_cursor value to the URL, and stop when has_more is false. See Pagination.
When it stops
The script above reads the answer whatever its status and passes the message on as output values. The automation's run history shows them, and a later action can email or post them.
When credits run out, the status is 402 and error.type is INSUFFICIENT_CREDITS. Read error.message for the text and error.details.checkout_url for the link that opens checkout. When the link is absent, error.details.top_up_url opens the billing page.
Never retry a 402, because it fails until credits are added. Retry a 429 after the seconds in the Retry-After header, and a 502, 503 or 504 after a short backoff. See Errors.
What a run costs
It depends on the endpoint, and some endpoints are priced by what they return. Endpoint pricing lists each one, and Credits explains cache hits and refunds. An automation that fires on every new record calls the API every time. GET /v1/utility/estimate quotes a call for 0 credits.
