Quickstart: Build a Social Media Post Generator as a REST API
Quickstart: Build a Social Media Post Generator as a REST API
Quickstart: Build a Social Media Post Generator as a REST API
This quickstart shows you how to build a simple Flow, package it in a Product, and make it available through a REST API Surface from the Runtype dashboard.
New to these concepts? Start with What are Flows?, What are Products?, and What are Surfaces?.
You’ll create a Flow that turns website content into social media posts, then deploy it as a live REST API endpoint you can call from any application.
You’ll build a Flow with two steps: one to fetch website content and one to generate social posts from it.
{{website}}. This creates a variable you’ll fill in each time you run the Flow.The double-curly-brace syntax ({{variable}}) lets you pass dynamic values into your Flow. Any step can reference variables set by earlier steps. Here, {{fetch_result}} contains the output from the Fetch URL step.
Before deploying, make sure the Flow works as expected.
If the output does not look right, go back and adjust the prompt in the Run Task step. You can iterate as many times as you need.
A Product groups your Flows and Agents for deployment. Each Product has one or more Surfaces that people or applications use to interact with your Capabilities, and one or more Capabilities that are powered by your Flows or Agents.
Runtype creates a Product with your Flow attached as a Capability and a REST API Surface ready to accept requests.
Your Surface is live. Open your new Product to find the endpoint URL and API key.
curl
TypeScript
Replace YOUR_PRODUCT_ID, YOUR_SURFACE_ID, and YOUR_SURFACE_API_KEY with the values shown on your Product page.
You now have a working REST API that turns any article into social media content, ready to integrate into your app, CMS, or automation workflow.