Attach an existing data endpoint function
Attach a deployed function from the same project and register the flow’s Kapso data endpoint with Meta. Multiple flows can share one function. Requires a WhatsApp phone number and flows encryption to be configured. Does not create or deploy a function. Replaces any previous association without deleting the previous function or rotating the endpoint secret. Updating or deploying a shared function affects every flow using it. Published flows are automatically republished; a republish failure returns HTTP 200 with data.warning and leaves the new association in place.
curl --request PATCH \
--url https://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"function_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint"
payload = { "function_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({function_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint', 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://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'function_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint"
payload := strings.NewReader("{\n \"function_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"function_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"function_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"function_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"function_name": "<string>",
"status": "draft",
"endpoint_url": "<string>",
"last_deployed_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"flow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"flow_data_endpoint_function_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"flow_has_encryption": true,
"warning": "<string>"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Path Parameters
Body
UUID of an existing deployed function in this project. Null or empty values are rejected.
Response
Function attached and endpoint registered. Check data.warning for republish failures.
Show child attributes
Show child attributes
Was this page helpful?
curl --request PATCH \
--url https://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"function_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint"
payload = { "function_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({function_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint', 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://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'function_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint"
payload := strings.NewReader("{\n \"function_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"function_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kapso.ai/platform/v1/whatsapp/flows/{flow_id}/data_endpoint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"function_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"function_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"function_name": "<string>",
"status": "draft",
"endpoint_url": "<string>",
"last_deployed_at": "2023-11-07T05:31:56Z",
"code": "<string>",
"flow_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"flow_data_endpoint_function_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"flow_has_encryption": true,
"warning": "<string>"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}
