RelayPointdocs

RelayPoint Connect

RelayPoint Connect

Let your own users connect their social, Google Drive and WhatsApp accounts from your website or portal, then post and message through one API.

RelayPoint Connect lets your users (for example a real-estate agency's agents) connect their own Facebook, Instagram, LinkedIn, TikTok, YouTube, Google Business Profile, X, Google Drive and WhatsApp accounts in a secure RelayPoint popup, without RelayPoint touching your code. Your server then posts to their networks, uses their Drive files and messages their customers on WhatsApp, through the API.

Three ways to use it

  • WordPress: install the RelayPoint Connect plugin and add a block or shortcode. See WordPress plugin.
  • Any stack: your server creates a connect session with your secret key, and the browser opens the popup with the relaypoint-connect.v1.js script and your publishable key. Quick-starts below for plain PHP, Laravel, Node.js and plain JavaScript.
  • No code: send your users to the hosted, branded Social hub with a short-lived link.

The package

Live Connect needs the RelayPoint Connections package on the workspace (for a sub-account, on its reseller): US$120 per month with 50 Connect accounts included. Buy it in Dashboard › Billing; resellers resell it at their own margin. Without it, live sessions, hub links and connections return 402 package_required. Test mode is free.

  • The 50 accounts are an allowance reserved for Connect connections (connections of your end users): they are not part of your general connection pool, and your other connections never use them. Each Connect account above the allowance costs US$1 per month (the package's extra-account price), billed from the wallet.
  • Fair use per account: 25 posts per connected account per day, 1,000 WhatsApp messages per number per day, and 30 posts per X account per month through RelayPoint's own X app. Above that: 429 daily_limit_reached.
  • AI assist (captions, hashtags, listing to post) is billed from your AI Credits like any other text call.

Keys and allowed origins

Connect uses two kinds of key, one pair per mode (test and live):

KeyFormatWhereWhat it can do
Secret keyrp_live_… / rp_test_…Your server onlyEverything. Scopes: connections (sessions, hub links, status, end users, settings, connections), social, drive, whatsapp; * covers all of them.
Publishable keyrp_pk_live_… / rp_pk_test_…Safe in the browserOpens the connect popup and reads the session's connections, only from the key's allowed origins.

Create publishable keys and set their allowed origins in Dashboard › API keys › Publishable keys. An origin is scheme://host[:port] with no path, for example https://www.example.com. Add both the apex and the www origin if your site answers on both. Live keys need https; test keys also accept http://localhost and http://127.0.0.1 on any port.

End users

end_user_id is your own id for the person or entity that owns the connections: 1 to 128 characters from A–Z a–z 0–9 . _ : @ -. Use a stable id from your portal (for example agent_123), company for your own company pages, or wp:<user id> (what the WordPress plugin uses). Connections, posts, media and hub sessions are separated by account, mode and end user.

Each end user has a role: member (default), drafter or approver, set with PATCH /v1/connect/end_users/{id}. With approvals switched on, drafters' posts wait for an approver. See Social posting.

The nine providers

Every connection is on the subscriber's own account. provider values and their rules:

`provider`What it doesRules
facebookPosts to the Facebook Pages the person manages (text, link, image)Meta App Review
instagramInstagram Business/Creator accounts linked to a Page; an image is requiredMeta App Review
linkedinPosts as the member; company pages once approvedCompany pages need LinkedIn's Community Management API approval. Until then only member posting is offered (linkedin_member_only).
google_driveLists, uploads and downloads files, Google Picker, import to the media librarydrive.file only: RelayPoint sees only files it created or that were picked
tiktokVideo and photo postsPrivate (SELF_ONLY) until RelayPoint's app passes TikTok's audit: warning tiktok_private_only
youtubeVideo uploadsAbout 1,600 quota units per upload (10,000 per day by default). With no quota left the target is queued (youtube_quota_reached) and retried after the daily reset.
google_businessLocal posts on Business Profile locationsHidden until Google grants Business Profile API access
xPosts (text, image)Bring your own key: your workspace's own X developer app by default (x_key_required until set). Optionally RelayPoint's X app, with a monthly post cap per account.
whatsappWhatsApp Business Platform through Meta Embedded SignupMessaging, not posting. The subscriber's own number; Meta bills message fees to the subscriber's own WhatsApp Business account. See WhatsApp.

Platform approvals (Meta, LinkedIn, Google, TikTok, YouTube quota, X) are recorded by RelayPoint; GET /v1/connect/status tells you what is available to your account right now.

How it works

  1. Your server calls POST /v1/connect/sessions with the secret key and the end user's id, and gives only the `token` to the browser.
  2. In a click handler, the browser calls RelayPointConnect.open({ publishableKey, sessionToken }). The popup shows the providers, the person signs in with the network, and onSuccess receives the connection.
  3. List connections from the browser with RelayPointConnect.listConnections(), or from your server with GET /v1/connections?end_user_id=….
  4. Post with POST /v1/social/posts, and receive social.post.published or social.post.failed webhooks.
  5. Optionally, open the hosted Social hub with a hub link from POST /v1/connect/hub-links.
curl
curl https://api.relaypoints.online/v1/connect/sessions \
  -H "Authorization: Bearer $RELAYPOINT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "end_user_id": "agent_123", "providers": ["facebook", "instagram", "linkedin"] }'
JSON
{
  "id": "cs_…",
  "object": "connect_session",
  "end_user_id": "agent_123",
  "mode": "test",
  "providers": ["facebook", "instagram", "linkedin"],
  "status": "open",
  "token": "cst_…",
  "url": "https://app.relaypoints.online/connect/s/cst_…",
  "connections": [],
  "expires_at": 1793491200,
  "created": 1793487600
}

Quick-start: plain PHP (cURL)

A minimal client plus one small script per step. Put the secret key in an environment variable (RELAYPOINT_SECRET_KEY), never in a page.

PHP
<?php
// relaypoint.php: a tiny client. The secret key stays on your server (an environment variable).
const RP_API = "https://api.relaypoints.online";

function rp(string $method, string $path, ?array $body = null): array {
    $headers = ["Authorization: Bearer " . getenv("RELAYPOINT_SECRET_KEY"), "Content-Type: application/json"];
    if ($method !== "GET") $headers[] = "Idempotency-Key: " . bin2hex(random_bytes(16));
    $ch = curl_init(RP_API . $path);
    curl_setopt_array($ch, [CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => $headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30]);
    if ($body !== null) curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
    $res = json_decode((string) curl_exec($ch), true);
    if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
        throw new RuntimeException(($res["error"]["code"] ?? "error") . ": " . ($res["error"]["message"] ?? ""));
    }
    return $res;
}

// connect-session.php: called by the "Connect your socials" button (the agent is logged in to your portal).
require "relaypoint.php";
session_start();
$endUser = "agent_" . $_SESSION["agent_id"]; // your own, stable id for this agent
$s = rp("POST", "/v1/connect/sessions", ["end_user_id" => $endUser, "providers" => "all"]);
header("Content-Type: application/json");
echo json_encode(["token" => $s["token"]]); // only the session token goes to the browser

// connections.php: the agent's connected accounts.
$list = rp("GET", "/v1/connections?end_user_id=" . urlencode($endUser));
foreach ($list["data"] as $c) echo $c["provider"], ": ", $c["account_label"], " (", $c["status"], ")\n";

// post.php: post to the agent's networks (adapted per network; 422 validation_failed if one can't take it).
$post = rp("POST", "/v1/social/posts", [
    "end_user_id" => $endUser,
    "text" => "New listing in Umhlanga: 3 bed, sea views.",
    "image_url" => "https://www.example.com/uploads/listing.jpg",
    "link_url" => "https://www.example.com/listing/123",
    "targets" => ["facebook", "instagram", "linkedin"],
]);
echo $post["id"], " ", $post["status"]; // publishing, then published (webhook social.post.published)

// social-hub.php: open the hosted Social hub for this agent (no RelayPoint login).
$link = rp("POST", "/v1/connect/hub-links", ["end_user_id" => $endUser, "return_url" => "https://www.example.com/portal"]);
header("Location: " . $link["url"], true, 303);

The page with the button. It fetches the session token first, because open() must run directly in the click handler or the browser blocks the popup.

HTML
<!-- On your portal page (served from an allowed origin) -->
<button id="connect-socials" type="button">Connect your socials</button>
<a href="/social-hub.php">Open the Social hub</a>
<ul id="my-accounts"></ul>

<script src="https://app.relaypoints.online/js/relaypoint-connect.v1.js" defer></script>
<script>
  const PUBLISHABLE_KEY = "rp_pk_test_…"; // safe in the browser: works only from its allowed origins
  let sessionToken = null;

  async function showAccounts() {
    const { data } = await RelayPointConnect.listConnections({ publishableKey: PUBLISHABLE_KEY, sessionToken });
    const list = document.getElementById("my-accounts");
    list.replaceChildren(...data.map((c) => Object.assign(document.createElement("li"), { textContent: c.provider + ": " + (c.account_label || c.id) })));
  }

  document.addEventListener("DOMContentLoaded", async () => {
    // Get the session token BEFORE the click: open() must run directly in the click handler.
    const r = await fetch("/connect-session.php", { method: "POST", credentials: "same-origin" });
    sessionToken = (await r.json()).token;
    showAccounts();
  });

  document.getElementById("connect-socials").addEventListener("click", () => {
    RelayPointConnect.open({
      publishableKey: PUBLISHABLE_KEY,
      sessionToken,
      // provider: "facebook",              // optional: skip the provider picker
      onSuccess: (r) => showAccounts(),     // r.connection = { id, provider, account_label }
      // Some sign-in pages cut the link to this page, so the result may only arrive as onExit(null)
      // when the popup closes: refresh the list here too.
      onExit: (err) => { if (err) console.warn(err.code, err.message); showAccounts(); },
    });
  });
</script>

Quick-start: Laravel

A controller using the Http facade, four routes behind your auth middleware, and a Blade view with the button. Put the keys in .env (RELAYPOINT_SECRET_KEY, RELAYPOINT_PUBLISHABLE_KEY).

<?php
// config/services.php
'relaypoint' => [
    'url' => env('RELAYPOINT_API_BASE', 'https://api.relaypoints.online'),
    'secret' => env('RELAYPOINT_SECRET_KEY'),           // rp_test_… then rp_live_… (server only)
    'publishable' => env('RELAYPOINT_PUBLISHABLE_KEY'), // rp_pk_test_… then rp_pk_live_…
],

// app/Http/Controllers/SocialController.php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;

class SocialController extends Controller
{
    private function rp()
    {
        return Http::baseUrl(config('services.relaypoint.url'))
            ->withToken(config('services.relaypoint.secret'))
            ->withHeaders(['Idempotency-Key' => (string) Str::uuid()])
            ->acceptJson()->timeout(30)->throw();
    }

    private function endUser(Request $request): string
    {
        return 'agent_' . $request->user()->id; // your own, stable id for the agent
    }

    public function session(Request $request)
    {
        $s = $this->rp()->post('/v1/connect/sessions', ['end_user_id' => $this->endUser($request), 'providers' => 'all'])->json();
        return response()->json(['token' => $s['token']]);
    }

    public function connections(Request $request)
    {
        return $this->rp()->get('/v1/connections', ['end_user_id' => $this->endUser($request)])->json();
    }

    public function post(Request $request)
    {
        $data = $request->validate(['text' => 'required|string|max:5000', 'image_url' => 'nullable|url', 'link_url' => 'nullable|url', 'targets' => 'nullable|array']);
        $body = array_filter($data + ['end_user_id' => $this->endUser($request), 'targets' => ['facebook', 'instagram', 'linkedin']], fn ($v) => $v !== null);
        return $this->rp()->post('/v1/social/posts', $body)->json();
    }

    public function hub(Request $request)
    {
        $link = $this->rp()->post('/v1/connect/hub-links', [
            'end_user_id' => $this->endUser($request),
            'display_name' => $request->user()->name,
            'return_url' => url('/portal'),
        ])->json();
        return redirect()->away($link['url']);
    }
}

// routes/web.php
use App\Http\Controllers\SocialController;

Route::middleware('auth')->group(function () {
    Route::post('/social/session', [SocialController::class, 'session']);
    Route::get('/social/connections', [SocialController::class, 'connections']);
    Route::post('/social/posts', [SocialController::class, 'post']);
    Route::get('/social/hub', [SocialController::class, 'hub']);
});

Quick-start: Node.js (Express)

Node 18 or later has fetch built in. The browser side is the same as for PHP, pointing at /api/connect-session.

JavaScript
// server.js (Node.js 18+, Express 5: npm i express@5)
import express from "express";

const API = "https://api.relaypoints.online";
const SECRET = process.env.RELAYPOINT_SECRET_KEY; // rp_test_… then rp_live_…: never send it to a browser

async function rp(method, path, body) {
  const res = await fetch(API + path, {
    method,
    headers: {
      Authorization: "Bearer " + SECRET,
      "Content-Type": "application/json",
      ...(method === "GET" ? {} : { "Idempotency-Key": crypto.randomUUID() }),
    },
    body: body ? JSON.stringify(body) : undefined,
  });
  const data = await res.json();
  if (!res.ok) throw Object.assign(new Error(data.error.message), { code: data.error.code, status: res.status });
  return data;
}

const app = express();
app.use(express.json());
// req.user comes from your own login (session, JWT…).
const endUser = (req) => "agent_" + req.user.id;

app.post("/api/connect-session", async (req, res) => {
  const s = await rp("POST", "/v1/connect/sessions", { end_user_id: endUser(req), providers: "all" });
  res.json({ token: s.token }); // only the token goes to the browser
});

app.get("/api/connections", async (req, res) => {
  res.json(await rp("GET", "/v1/connections?end_user_id=" + encodeURIComponent(endUser(req))));
});

app.post("/api/posts", async (req, res) => {
  try {
    const post = await rp("POST", "/v1/social/posts", {
      end_user_id: endUser(req),
      text: req.body.text,
      image_url: req.body.image_url,
      link_url: req.body.link_url,
      targets: req.body.targets ?? ["facebook", "instagram", "linkedin"],
    });
    res.status(201).json(post);
  } catch (e) {
    res.status(e.status ?? 500).json({ code: e.code, message: e.message }); // e.g. 422 validation_failed
  }
});

app.get("/social-hub", async (req, res) => {
  const link = await rp("POST", "/v1/connect/hub-links", { end_user_id: endUser(req), display_name: req.user.name, return_url: "https://www.example.com/portal" });
  res.redirect(303, link.url);
});

app.listen(3000);

Quick-start: plain JavaScript in the browser

The script exposes RelayPointConnect.open() and RelayPointConnect.listConnections(). Load it from RelayPoint (don't copy it), call open() inside a click handler, and get the session token from your server first.

HTML
<script src="https://app.relaypoints.online/js/relaypoint-connect.v1.js" defer></script>
<button id="connect" type="button">Connect Facebook</button>
<script>
  let token;
  // 1. Ask YOUR server for a session token (it calls POST /v1/connect/sessions with the secret key).
  document.addEventListener("DOMContentLoaded", async () => {
    token = (await (await fetch("/api/connect-session", { method: "POST" })).json()).token;
  });

  // 3. Read the end user's connections from the browser (publishable key + session token).
  async function refresh() {
    const { data } = await RelayPointConnect.listConnections({ publishableKey: "rp_pk_test_…", sessionToken: token });
    console.log(data); // [{ id, provider, account_label, status }]
  }

  // 2. Open the popup inside the click handler (pop-up blockers allow only that).
  document.getElementById("connect").addEventListener("click", () => {
    const handle = RelayPointConnect.open({
      publishableKey: "rp_pk_test_…",
      sessionToken: token,
      provider: "facebook",
      onSuccess: ({ connection }) => {
        console.log("connected", connection.id, connection.account_label);
        refresh();
      },
      // Some sign-in pages cut window.opener: the popup then closes with onExit(null) and no
      // onSuccess. Always refresh the list on exit too.
      onExit: (err) => {
        if (err) console.warn(err.code, err.message);
        refresh();
      },
    });
  });
</script>

Full-page redirect instead of a popup

Where popups are awkward (some in-app browsers, kiosk screens), send the browser to the session's url instead. With redirect_url set, the person comes back to your page with relaypoint_status, connection and, on errors, code in the query string.

curl
curl https://api.relaypoints.online/v1/connect/sessions \
  -H "Authorization: Bearer $RELAYPOINT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "end_user_id": "agent_123", "providers": ["linkedin"], "redirect_url": "https://www.example.com/portal/socials" }'

# Redirect the browser to the "url" of the response. When the person is done, they come back to:
# https://www.example.com/portal/socials?relaypoint_status=connected&connection=conn_…
# or ?relaypoint_status=error&code=…

The Social hub (no code)

Instead of building your own screens, send users to RelayPoint's hosted Social hub: accounts, a multi-network composer with previews, scheduling, approvals, analytics, a WhatsApp inbox and Drive, branded with your name, logo and colours. Your server creates a single-use link and redirects to it. See Social hub and hub links.

Test mode

  • Test keys (rp_test_…, rp_pk_test_…) create test sessions. The popup shows Simulate connection instead of the network's sign-in; test connections are free and never call a network.
  • Posts are simulated: external_id starts with test_, TikTok goes through processing, and sample metrics appear. Put [simulate:fail] or [simulate:retry] in the text to force a failure or a retry.
  • Drive returns sample files; WhatsApp gets a test number with sample templates. AI assist returns sample text at no cost.

Checking your setup

GET /v1/connect/status says whether the package is active, whether a publishable key is valid for the secret key's account and mode and allows an origin, the script URL, and which providers are available (with a reason when not: not_enabled, not_configured, awaiting_platform_approval, x_key_required) plus notes. The WordPress plugin's "Check connection" button calls it.

curl
curl "https://api.relaypoints.online/v1/connect/status?publishable_key=rp_pk_test_…&origin=https://www.example.com" \
  -H "Authorization: Bearer $RELAYPOINT_SECRET_KEY"
JSON
{
  "object": "connect_status",
  "account": { "id": "org_…", "name": "Example Realty" },
  "mode": "test",
  "package_active": true,
  "publishable_key": { "valid": true, "mode": "test", "origin_allowed": true, "allowed_origins": ["https://www.example.com"] },
  "script_url": "https://app.relaypoints.online/js/relaypoint-connect.v1.js",
  "providers": [
    { "provider": "facebook", "catalog_slug": "facebook-pages", "available": true, "reason": null, "notes": [] },
    { "provider": "tiktok", "catalog_slug": "tiktok-business", "available": true, "reason": null, "notes": ["tiktok_private_only"] },
    { "provider": "google_business", "catalog_slug": "google-business-profile", "available": false, "reason": "awaiting_platform_approval", "notes": [] }
  ]
}

Downloads

All generated from the API itself, so they always match it. The full reference is in the API reference.

Text
/downloads/relaypoint-connect.zip                     WordPress plugin
/downloads/relaypoint-connect.postman_collection.json  Postman collection (v2.1)
/downloads/relaypoint-connect.openapi.json            OpenAPI 3.1 (Connect endpoints only)
/openapi.json                                         OpenAPI 3.1 (the whole API)