Create a connection
curl --request POST \
--url https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"provider": "google_m_b",
"return_url": "https://app.acmedealers.test/integrations/callback",
"state": "dealer-4821",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"coexistence": true,
"max_accounts": 50,
"allow_unverified": true,
"server": "<string>",
"handle": "<string>",
"bot_token": "123456:ABC…",
"name": "Acme Motors",
"takeover": true
}
'import requests
url = "https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections"
payload = {
"provider": "google_m_b",
"return_url": "https://app.acmedealers.test/integrations/callback",
"state": "dealer-4821",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"coexistence": True,
"max_accounts": 50,
"allow_unverified": True,
"server": "<string>",
"handle": "<string>",
"bot_token": "123456:ABC…",
"name": "Acme Motors",
"takeover": True
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
provider: 'google_m_b',
return_url: 'https://app.acmedealers.test/integrations/callback',
state: 'dealer-4821',
account_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
channel_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
coexistence: true,
max_accounts: 50,
allow_unverified: true,
server: '<string>',
handle: '<string>',
bot_token: '123456:ABC…',
name: 'Acme Motors',
takeover: true
})
};
fetch('https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider' => 'google_m_b',
'return_url' => 'https://app.acmedealers.test/integrations/callback',
'state' => 'dealer-4821',
'account_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'channel_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'coexistence' => true,
'max_accounts' => 50,
'allow_unverified' => true,
'server' => '<string>',
'handle' => '<string>',
'bot_token' => '123456:ABC…',
'name' => 'Acme Motors',
'takeover' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections"
payload := strings.NewReader("{\n \"provider\": \"google_m_b\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"account_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": true,\n \"max_accounts\": 50,\n \"allow_unverified\": true,\n \"server\": \"<string>\",\n \"handle\": \"<string>\",\n \"bot_token\": \"123456:ABC…\",\n \"name\": \"Acme Motors\",\n \"takeover\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"google_m_b\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"account_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": true,\n \"max_accounts\": 50,\n \"allow_unverified\": true,\n \"server\": \"<string>\",\n \"handle\": \"<string>\",\n \"bot_token\": \"123456:ABC…\",\n \"name\": \"Acme Motors\",\n \"takeover\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"google_m_b\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"account_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": true,\n \"max_accounts\": 50,\n \"allow_unverified\": true,\n \"server\": \"<string>\",\n \"handle\": \"<string>\",\n \"bot_token\": \"123456:ABC…\",\n \"name\": \"Acme Motors\",\n \"takeover\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "facebook_page",
"mode": "relay",
"reconnect": true,
"status": "pending",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"account": {
"id": 123,
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "<string>",
"name": "<string>",
"username": "<string>"
},
"accounts": [
{
"id": 123,
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "<string>",
"name": "<string>",
"username": "<string>"
}
],
"skipped": [
{
"name": "<string>",
"reason": "<string>"
}
],
"max_accounts": 123,
"allow_unverified": true,
"coexistence": true,
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error_code": "<string>",
"state": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"connect_url": "<string>"
},
"meta": {
"webhook_registered": true,
"webhook_taken_over": true
}
}{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "facebook_page",
"mode": "relay",
"reconnect": true,
"status": "pending",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"account": {
"id": 123,
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "<string>",
"name": "<string>",
"username": "<string>"
},
"accounts": [
{
"id": 123,
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "<string>",
"name": "<string>",
"username": "<string>"
}
],
"skipped": [
{
"name": "<string>",
"reason": "<string>"
}
],
"max_accounts": 123,
"allow_unverified": true,
"coexistence": true,
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error_code": "<string>",
"state": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"connect_url": "<string>"
},
"meta": {
"webhook_registered": true,
"webhook_taken_over": true
}
}{
"success": false,
"message": "Invalid or inactive API key."
}{
"success": false,
"message": "<string>",
"error_code": "<string>"
}{
"success": false,
"message": "Validation failed.",
"errors": {}
}Client Connect API
Create a connection
Starts a 30-minute session and returns connect_url. Open it as a top-level navigation in your customer’s browser, never in an iframe or a fetch. account_id or channel_id makes it a reconnect. For telegram send bot_token instead of return_url: the bot is connected in this call and the connection comes back connected, with meta.webhook_registered and meta.webhook_taken_over (201 for a new bot, 200 for the same bot again). See Client Connect API.
POST
/
partner
/
workspaces
/
{workspace}
/
connections
Create a connection
curl --request POST \
--url https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"provider": "google_m_b",
"return_url": "https://app.acmedealers.test/integrations/callback",
"state": "dealer-4821",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"coexistence": true,
"max_accounts": 50,
"allow_unverified": true,
"server": "<string>",
"handle": "<string>",
"bot_token": "123456:ABC…",
"name": "Acme Motors",
"takeover": true
}
'import requests
url = "https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections"
payload = {
"provider": "google_m_b",
"return_url": "https://app.acmedealers.test/integrations/callback",
"state": "dealer-4821",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"coexistence": True,
"max_accounts": 50,
"allow_unverified": True,
"server": "<string>",
"handle": "<string>",
"bot_token": "123456:ABC…",
"name": "Acme Motors",
"takeover": True
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
provider: 'google_m_b',
return_url: 'https://app.acmedealers.test/integrations/callback',
state: 'dealer-4821',
account_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
channel_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
coexistence: true,
max_accounts: 50,
allow_unverified: true,
server: '<string>',
handle: '<string>',
bot_token: '123456:ABC…',
name: 'Acme Motors',
takeover: true
})
};
fetch('https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider' => 'google_m_b',
'return_url' => 'https://app.acmedealers.test/integrations/callback',
'state' => 'dealer-4821',
'account_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'channel_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'coexistence' => true,
'max_accounts' => 50,
'allow_unverified' => true,
'server' => '<string>',
'handle' => '<string>',
'bot_token' => '123456:ABC…',
'name' => 'Acme Motors',
'takeover' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections"
payload := strings.NewReader("{\n \"provider\": \"google_m_b\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"account_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": true,\n \"max_accounts\": 50,\n \"allow_unverified\": true,\n \"server\": \"<string>\",\n \"handle\": \"<string>\",\n \"bot_token\": \"123456:ABC…\",\n \"name\": \"Acme Motors\",\n \"takeover\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"google_m_b\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"account_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": true,\n \"max_accounts\": 50,\n \"allow_unverified\": true,\n \"server\": \"<string>\",\n \"handle\": \"<string>\",\n \"bot_token\": \"123456:ABC…\",\n \"name\": \"Acme Motors\",\n \"takeover\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onlysocial.io/api/partner/workspaces/{workspace}/connections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"google_m_b\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"account_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": true,\n \"max_accounts\": 50,\n \"allow_unverified\": true,\n \"server\": \"<string>\",\n \"handle\": \"<string>\",\n \"bot_token\": \"123456:ABC…\",\n \"name\": \"Acme Motors\",\n \"takeover\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "facebook_page",
"mode": "relay",
"reconnect": true,
"status": "pending",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"account": {
"id": 123,
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "<string>",
"name": "<string>",
"username": "<string>"
},
"accounts": [
{
"id": 123,
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "<string>",
"name": "<string>",
"username": "<string>"
}
],
"skipped": [
{
"name": "<string>",
"reason": "<string>"
}
],
"max_accounts": 123,
"allow_unverified": true,
"coexistence": true,
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error_code": "<string>",
"state": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"connect_url": "<string>"
},
"meta": {
"webhook_registered": true,
"webhook_taken_over": true
}
}{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "facebook_page",
"mode": "relay",
"reconnect": true,
"status": "pending",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"account": {
"id": 123,
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "<string>",
"name": "<string>",
"username": "<string>"
},
"accounts": [
{
"id": 123,
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "<string>",
"name": "<string>",
"username": "<string>"
}
],
"skipped": [
{
"name": "<string>",
"reason": "<string>"
}
],
"max_accounts": 123,
"allow_unverified": true,
"coexistence": true,
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error_code": "<string>",
"state": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"connect_url": "<string>"
},
"meta": {
"webhook_registered": true,
"webhook_taken_over": true
}
}{
"success": false,
"message": "Invalid or inactive API key."
}{
"success": false,
"message": "<string>",
"error_code": "<string>"
}{
"success": false,
"message": "Validation failed.",
"errors": {}
}Headers
Path Parameters
Body
application/json
Aliases accepted: facebook and messenger (facebook_page), instagram_login, gbp, x, vk, bluesky.
Available options:
facebook_page, instagram, instagram_direct, linkedin, linkedin_page, youtube, google_m_b, threads, tiktok, pinterest, reddit, tumblr, twitter, v_kontakte, blue_sky, mastodon, whatsapp, telegram Example:
"google_m_b"
