Agent Connectors
Set up a WhatsApp app webhook (Beta)
Beta. Returns the app-level callback URL and verification token that must be saved in Meta before the first WhatsApp phone connector is created. The caller must be allowed to manage the agent. The stable verification token is returned only in this no-store response and is not a Meta access token.
POST
/
api
/
v1
/
agents
/
{id}
/
connectors
/
whatsapp
/
setup
Go (SDK)
package main
import(
"context"
mka1 "github.com/MeetKai/mka1-sdks/go"
"github.com/MeetKai/mka1-sdks/go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := mka1.New(
mka1.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
res, err := s.AgentConnectors.SetupWhatsAppAppWebhook(ctx, "<id>", components.WhatsAppWebhookSetupRequest{
AppID: "<id>",
}, nil)
if err != nil {
log.Fatal(err)
}
if res.WhatsAppWebhookSetup != nil {
// handle response
}
}using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.AgentConnectors.SetupWhatsAppAppWebhookAsync(
id: "<id>",
body: new WhatsAppWebhookSetupRequest() {
AppId = "<id>",
}
);
// handle responsefrom meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.agent_connectors.setup_whats_app_app_webhook(id="<id>", app_id="<id>")
# Handle response
print(res)import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.agentConnectors.setupWhatsAppAppWebhook({
id: "<id>",
whatsAppWebhookSetupRequest: {
appId: "<id>",
},
});
console.log(result);
}
run();curl --request POST \
--url https://apigw.mka1.com/api/v1/agents/{id}/connectors/whatsapp/setup \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"app_id": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({app_id: '<string>'})
};
fetch('https://apigw.mka1.com/api/v1/agents/{id}/connectors/whatsapp/setup', 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://apigw.mka1.com/api/v1/agents/{id}/connectors/whatsapp/setup",
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([
'app_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://apigw.mka1.com/api/v1/agents/{id}/connectors/whatsapp/setup")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"app_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/agents/{id}/connectors/whatsapp/setup")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"app_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"object": "agent.connector.whatsapp_webhook_setup",
"app_id": "<string>",
"callback_url": "<string>",
"verify_token": "<string>"
}{
"error": {
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
Send Authorization: Bearer , using an MKA1 API key for automation or an OAuth API access token for a signed-in application. Use a dynamic security callback to refresh OAuth access tokens. Browser session-only operations still require their declared cookie.
Headers
Optional external end-user identifier forwarded by the API gateway.
Path Parameters
The agent ID.
Body
application/json
Maximum string length:
64Pattern:
^[0-9]+$Response
WhatsApp app webhook setup values.
Was this page helpful?
⌘I
Go (SDK)
package main
import(
"context"
mka1 "github.com/MeetKai/mka1-sdks/go"
"github.com/MeetKai/mka1-sdks/go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := mka1.New(
mka1.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
res, err := s.AgentConnectors.SetupWhatsAppAppWebhook(ctx, "<id>", components.WhatsAppWebhookSetupRequest{
AppID: "<id>",
}, nil)
if err != nil {
log.Fatal(err)
}
if res.WhatsAppWebhookSetup != nil {
// handle response
}
}using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.AgentConnectors.SetupWhatsAppAppWebhookAsync(
id: "<id>",
body: new WhatsAppWebhookSetupRequest() {
AppId = "<id>",
}
);
// handle responsefrom meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.agent_connectors.setup_whats_app_app_webhook(id="<id>", app_id="<id>")
# Handle response
print(res)import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.agentConnectors.setupWhatsAppAppWebhook({
id: "<id>",
whatsAppWebhookSetupRequest: {
appId: "<id>",
},
});
console.log(result);
}
run();curl --request POST \
--url https://apigw.mka1.com/api/v1/agents/{id}/connectors/whatsapp/setup \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"app_id": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({app_id: '<string>'})
};
fetch('https://apigw.mka1.com/api/v1/agents/{id}/connectors/whatsapp/setup', 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://apigw.mka1.com/api/v1/agents/{id}/connectors/whatsapp/setup",
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([
'app_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://apigw.mka1.com/api/v1/agents/{id}/connectors/whatsapp/setup")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"app_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/agents/{id}/connectors/whatsapp/setup")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"app_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"object": "agent.connector.whatsapp_webhook_setup",
"app_id": "<string>",
"callback_url": "<string>",
"verify_token": "<string>"
}{
"error": {
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"message": "<string>",
"details": "<unknown>"
}
}