from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.agent_connectors.create_agent_connector(id="<id>", provider="telegram", credentials={
"bot_token": "123456789:replace-with-telegram-bot-token",
}, access={
"mode": "allowlist",
"chat_ids": [
123456789,
],
}, name="support-bot")
# 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.createAgentConnector({
id: "<id>",
createAgentConnectorRequest: {
provider: "telegram",
name: "support-bot",
credentials: {
botToken: "123456789:replace-with-telegram-bot-token",
},
access: {
mode: "allowlist",
chatIds: [
123456789,
],
},
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.AgentConnectors.CreateAgentConnectorAsync(
id: "<id>",
body: new MeetKai.MKA1.Types.Components.CreateAgentConnectorRequest() {
Provider = CreateAgentConnectorRequestProvider.Telegram,
Name = "support-bot",
Credentials = new Credentials() {
BotToken = "123456789:replace-with-telegram-bot-token",
},
Access = new CreateAgentConnectorRequestAccess() {
Mode = CreateAgentConnectorRequestMode.Allowlist,
ChatIds = new List<long>() {
123456789,
},
},
}
);
// handle responsecurl --request POST \
--url https://apigw.mka1.com/api/v1/agents/{id}/connectors \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "telegram",
"name": "support-bot",
"credentials": {
"bot_token": "123456789:replace-with-telegram-bot-token"
},
"access": {
"mode": "allowlist",
"chat_ids": [
123456789
]
},
"drop_pending_updates": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
provider: 'telegram',
name: 'support-bot',
credentials: {bot_token: '123456789:replace-with-telegram-bot-token'},
access: {mode: 'allowlist', chat_ids: [123456789]},
drop_pending_updates: true
})
};
fetch('https://apigw.mka1.com/api/v1/agents/{id}/connectors', 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",
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' => 'telegram',
'name' => 'support-bot',
'credentials' => [
'bot_token' => '123456789:replace-with-telegram-bot-token'
],
'access' => [
'mode' => 'allowlist',
'chat_ids' => [
123456789
]
],
'drop_pending_updates' => true
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apigw.mka1.com/api/v1/agents/{id}/connectors"
payload := strings.NewReader("{\n \"provider\": \"telegram\",\n \"name\": \"support-bot\",\n \"credentials\": {\n \"bot_token\": \"123456789:replace-with-telegram-bot-token\"\n },\n \"access\": {\n \"mode\": \"allowlist\",\n \"chat_ids\": [\n 123456789\n ]\n },\n \"drop_pending_updates\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://apigw.mka1.com/api/v1/agents/{id}/connectors")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"telegram\",\n \"name\": \"support-bot\",\n \"credentials\": {\n \"bot_token\": \"123456789:replace-with-telegram-bot-token\"\n },\n \"access\": {\n \"mode\": \"allowlist\",\n \"chat_ids\": [\n 123456789\n ]\n },\n \"drop_pending_updates\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/agents/{id}/connectors")
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 \"provider\": \"telegram\",\n \"name\": \"support-bot\",\n \"credentials\": {\n \"bot_token\": \"123456789:replace-with-telegram-bot-token\"\n },\n \"access\": {\n \"mode\": \"allowlist\",\n \"chat_ids\": [\n 123456789\n ]\n },\n \"drop_pending_updates\": true\n}"
response = http.request(request)
puts response.read_body{
"object": "agent.connector",
"id": "<string>",
"agent_id": "<string>",
"provider": "telegram",
"name": "<string>",
"status": "<string>",
"provider_account_id": "<string>",
"provider_account_name": "<string>",
"config": "<string>",
"credentials_configured": true,
"last_error": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}Create a connector
Connects the agent to a Telegram bot, validates the bot token, and registers the agent’s webhook. An API key with every listed scope is required; its identity tuple and current scopes are stored as a non-widening ceiling, then revalidated with mk-authentication before every connector run; session and delegated end-user contexts are rejected. The required access policy controls which Telegram chats may invoke the agent.
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.agent_connectors.create_agent_connector(id="<id>", provider="telegram", credentials={
"bot_token": "123456789:replace-with-telegram-bot-token",
}, access={
"mode": "allowlist",
"chat_ids": [
123456789,
],
}, name="support-bot")
# 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.createAgentConnector({
id: "<id>",
createAgentConnectorRequest: {
provider: "telegram",
name: "support-bot",
credentials: {
botToken: "123456789:replace-with-telegram-bot-token",
},
access: {
mode: "allowlist",
chatIds: [
123456789,
],
},
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.AgentConnectors.CreateAgentConnectorAsync(
id: "<id>",
body: new MeetKai.MKA1.Types.Components.CreateAgentConnectorRequest() {
Provider = CreateAgentConnectorRequestProvider.Telegram,
Name = "support-bot",
Credentials = new Credentials() {
BotToken = "123456789:replace-with-telegram-bot-token",
},
Access = new CreateAgentConnectorRequestAccess() {
Mode = CreateAgentConnectorRequestMode.Allowlist,
ChatIds = new List<long>() {
123456789,
},
},
}
);
// handle responsecurl --request POST \
--url https://apigw.mka1.com/api/v1/agents/{id}/connectors \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider": "telegram",
"name": "support-bot",
"credentials": {
"bot_token": "123456789:replace-with-telegram-bot-token"
},
"access": {
"mode": "allowlist",
"chat_ids": [
123456789
]
},
"drop_pending_updates": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
provider: 'telegram',
name: 'support-bot',
credentials: {bot_token: '123456789:replace-with-telegram-bot-token'},
access: {mode: 'allowlist', chat_ids: [123456789]},
drop_pending_updates: true
})
};
fetch('https://apigw.mka1.com/api/v1/agents/{id}/connectors', 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",
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' => 'telegram',
'name' => 'support-bot',
'credentials' => [
'bot_token' => '123456789:replace-with-telegram-bot-token'
],
'access' => [
'mode' => 'allowlist',
'chat_ids' => [
123456789
]
],
'drop_pending_updates' => true
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apigw.mka1.com/api/v1/agents/{id}/connectors"
payload := strings.NewReader("{\n \"provider\": \"telegram\",\n \"name\": \"support-bot\",\n \"credentials\": {\n \"bot_token\": \"123456789:replace-with-telegram-bot-token\"\n },\n \"access\": {\n \"mode\": \"allowlist\",\n \"chat_ids\": [\n 123456789\n ]\n },\n \"drop_pending_updates\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://apigw.mka1.com/api/v1/agents/{id}/connectors")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"telegram\",\n \"name\": \"support-bot\",\n \"credentials\": {\n \"bot_token\": \"123456789:replace-with-telegram-bot-token\"\n },\n \"access\": {\n \"mode\": \"allowlist\",\n \"chat_ids\": [\n 123456789\n ]\n },\n \"drop_pending_updates\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/agents/{id}/connectors")
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 \"provider\": \"telegram\",\n \"name\": \"support-bot\",\n \"credentials\": {\n \"bot_token\": \"123456789:replace-with-telegram-bot-token\"\n },\n \"access\": {\n \"mode\": \"allowlist\",\n \"chat_ids\": [\n 123456789\n ]\n },\n \"drop_pending_updates\": true\n}"
response = http.request(request)
puts response.read_body{
"object": "agent.connector",
"id": "<string>",
"agent_id": "<string>",
"provider": "telegram",
"name": "<string>",
"status": "<string>",
"provider_account_id": "<string>",
"provider_account_name": "<string>",
"config": "<string>",
"credentials_configured": true,
"last_error": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"details": "<string>"
}
}Authorizations
Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.
Headers
Optional external end-user identifier forwarded by the API gateway.
Path Parameters
The agent ID.
Body
telegram Show child attributes
Show child attributes
The explicit Telegram chat allowlist permitted to invoke the agent.
Show child attributes
Show child attributes
1 - 120Always true: Telegram discards updates queued before this tenancy's webhook is registered.
true Response
Connector created and activated.
agent.connector telegram Connector lifecycle status, such as provisioning, activating, active, deleting, or error.
The Telegram bot user ID.
The Telegram bot username when one is available.
Whether encrypted provider credentials are stored for this connector.
Was this page helpful?