SocialCrawl

Use SocialCrawl with Flowise

Pull social media data into Flowise without writing a server.

You can call SocialCrawl from a Flowise agent with a Custom Tool. The tool runs a short JavaScript function that calls the API and returns the answer to the model. Setup takes three steps: store the key as a variable, write the tool, attach it to the agent.

Before you start

Create an API key in the dashboard under API Keys. In Flowise, add it as a variable named socialcrawlKey, and read it in the tool as $vars.socialcrawlKey. Never write it into the function. Prove the key with a call that costs nothing:

Check the key (0 credits)
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

Create a Custom Tool with one input property, handle. In the function, an input property is available as a variable with a $ prefix, so handle becomes $handle. The function must return a string.

Custom Tool function
const url =
  "https://www.socialcrawl.dev/v1/tiktok/profile?handle=" +
  encodeURIComponent($handle);

const res = await fetch(url, {
  headers: { "x-api-key": $vars.socialcrawlKey },
});
const body = await res.json();

if (!body.success) {
  return `SocialCrawl refused the call: ${body.error.type}. ${body.error.message}`;
}
return JSON.stringify(body.data);

Change the path to call any other endpoint, and add input properties for its parameters.

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.

Response (trimmed)
{
  "success": true,
  "data": { "author": { "username": "charlidamelio" } },
  "credits_used": 1,
  "credits_remaining": 99
}

To read the next page, give the tool a cursor input and send it as the cursor query parameter. Stop when pagination.has_more is false. See Pagination.

When it stops

A Custom Tool hands its returned text to the model, so the function above returns the refusal as text and the model tells the user. The tool never retries.

When credits run out, the answer is a 402 with error.type set to INSUFFICIENT_CREDITS. Return error.message, and add error.details.checkout_url, 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 agent that loops can call a tool many times in one conversation. GET /v1/utility/estimate quotes a call for 0 credits.

On this page