Create a connection
curl --request POST \
--url https://app.onlysocial.io/api/partner/workspaces/{workspace}/channel-connections \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"platform": "whatsapp",
"return_url": "https://app.acmedealers.test/integrations/callback",
"state": "dealer-4821",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"coexistence": true
}
'import requests
url = "https://app.onlysocial.io/api/partner/workspaces/{workspace}/channel-connections"
payload = {
"platform": "whatsapp",
"return_url": "https://app.acmedealers.test/integrations/callback",
"state": "dealer-4821",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"coexistence": 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({
platform: 'whatsapp',
return_url: 'https://app.acmedealers.test/integrations/callback',
state: 'dealer-4821',
channel_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
coexistence: true
})
};
fetch('https://app.onlysocial.io/api/partner/workspaces/{workspace}/channel-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}/channel-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([
'platform' => 'whatsapp',
'return_url' => 'https://app.acmedealers.test/integrations/callback',
'state' => 'dealer-4821',
'channel_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'coexistence' => 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}/channel-connections"
payload := strings.NewReader("{\n \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": 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}/channel-connections")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onlysocial.io/api/partner/workspaces/{workspace}/channel-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 \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": 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",
"platform": "whatsapp",
"coexistence": true,
"status": "pending",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error_code": "<string>",
"state": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"connect_url": "<string>"
}
}{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"platform": "whatsapp",
"coexistence": true,
"status": "pending",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error_code": "<string>",
"state": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"connect_url": "<string>"
}
}{
"success": false,
"message": "Invalid or inactive API key."
}{
"success": false,
"message": "<string>",
"error_code": "<string>"
}{
"success": false,
"message": "<string>",
"error_code": "<string>"
}Channel Connect
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. See Channel Connect.
POST
/
partner
/
workspaces
/
{workspace}
/
channel-connections
Create a connection
curl --request POST \
--url https://app.onlysocial.io/api/partner/workspaces/{workspace}/channel-connections \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"platform": "whatsapp",
"return_url": "https://app.acmedealers.test/integrations/callback",
"state": "dealer-4821",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"coexistence": true
}
'import requests
url = "https://app.onlysocial.io/api/partner/workspaces/{workspace}/channel-connections"
payload = {
"platform": "whatsapp",
"return_url": "https://app.acmedealers.test/integrations/callback",
"state": "dealer-4821",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"coexistence": 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({
platform: 'whatsapp',
return_url: 'https://app.acmedealers.test/integrations/callback',
state: 'dealer-4821',
channel_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
coexistence: true
})
};
fetch('https://app.onlysocial.io/api/partner/workspaces/{workspace}/channel-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}/channel-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([
'platform' => 'whatsapp',
'return_url' => 'https://app.acmedealers.test/integrations/callback',
'state' => 'dealer-4821',
'channel_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'coexistence' => 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}/channel-connections"
payload := strings.NewReader("{\n \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": 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}/channel-connections")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onlysocial.io/api/partner/workspaces/{workspace}/channel-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 \"platform\": \"whatsapp\",\n \"return_url\": \"https://app.acmedealers.test/integrations/callback\",\n \"state\": \"dealer-4821\",\n \"channel_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"coexistence\": 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",
"platform": "whatsapp",
"coexistence": true,
"status": "pending",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error_code": "<string>",
"state": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"connect_url": "<string>"
}
}{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"platform": "whatsapp",
"coexistence": true,
"status": "pending",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error_code": "<string>",
"state": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"connect_url": "<string>"
}
}{
"success": false,
"message": "Invalid or inactive API key."
}{
"success": false,
"message": "<string>",
"error_code": "<string>"
}{
"success": false,
"message": "<string>",
"error_code": "<string>"
}Authorizations
Your partner API key, pk_…. Backend only.
Headers
1–200 characters. The same key and request returns the same connection with 200; a different request on that key is a 409.
Maximum string length:
200Path Parameters
A workspace uuid from provisioning. It must be administered by a customer you provisioned.
Body
application/json
Available options:
whatsapp, facebook, instagram, tiktok Example:
"whatsapp"
One of your registered return URLs, exactly.
Example:
"https://app.acmedealers.test/integrations/callback"
Comes back on the return URL and in the completion event. No secrets or personal data.
Maximum string length:
500Example:
"dealer-4821"
Reconnect this existing channel.
WhatsApp only: keep the number on the WhatsApp Business app.
