AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
import { telegramCommons } from '../common';
import { telegramBotAuth } from '../..';
import { telegramSendLocationActionOutputSchema } from '../output-schemas';
export const telegramSendLocation = createAction({
auth: telegramBotAuth,
name: 'telegram_send_location',
classification: 'WRITE',
displayName: 'Send Location',
description: 'Send a geographic location (latitude/longitude) to a Telegram chat.',
audience: 'ai',
aiMetadata: {
description:
'Sends a point location (latitude + longitude) to a chat addressed by chat_id (a numeric id or @channelusername the bot can reach), optionally as a live location that updates for a set period. Use to share a place or track a moving position; both coordinates are required. Not idempotent: each call posts a new location message.',
idempotent: false,
},
outputSchema: telegramSendLocationActionOutputSchema,
props: {
chat_id: telegramCommons.chatIdProp(),
latitude: Property.Number({
displayName: 'Latitude',
description: 'Latitude of the location.',
required: true,
}),
longitude: Property.Number({
displayName: 'Longitude',
description: 'Longitude of the location.',
required: true,
}),
horizontal_accuracy: Property.Number({
displayName: 'Horizontal Accuracy',
description: 'Radius of uncertainty for the location, in meters (0–1500).',
required: false,
}),
live_period: Property.Number({
displayName: 'Live Period',
description:
'Number of seconds the location will be updated (60–86400). Use for live locations.',
required: false,
}),
heading: Property.Number({
displayName: 'Heading',
description: 'For live locations, direction the user is moving in degrees (1–360).',
required: false,
}),
proximity_alert_radius: Property.Number({
displayName: 'Proximity Alert Radius',
description:
'For live locations, the max distance (1–100000 m) for proximity alerts about approaching another chat member.',
required: false,
}),
message_thread_id: Property.ShortText({
displayName: 'Message Thread Id',
description:
'Unique identifier for the target message thread of the forum; supergroup forums only.',
required: false,
}),
disable_notification: telegramCommons.disableNotificationProp(),
protect_content: telegramCommons.protectContentProp(),
reply_to_message_id: telegramCommons.replyToMessageIdProp(),
reply_markup: Property.Json({
displayName: 'Reply Markup',
description:
'Advanced/optional. A raw JSON-serialized inline keyboard, e.g. {"inline_keyboard":[[{"text":"Open","url":"https://example.com"}]]}. Malformed markup is rejected by Telegram.',
required: false,
}),
},
async run(ctx) {
return await httpClient.sendRequest<never>({
method: HttpMethod.POST,
url: telegramCommons.getApiUrl(ctx.auth, 'sendLocation'),
body: {
chat_id: ctx.propsValue.chat_id,
latitude: ctx.propsValue.latitude,
longitude: ctx.propsValue.longitude,
message_thread_id: ctx.propsValue.message_thread_id ?? undefined,
horizontal_accuracy: ctx.propsValue.horizontal_accuracy ?? undefined,
live_period: ctx.propsValue.live_period ?? undefined,
heading: ctx.propsValue.heading ?? undefined,
proximity_alert_radius: ctx.propsValue.proximity_alert_radius ?? undefined,
disable_notification: ctx.propsValue.disable_notification ?? false,
protect_content: ctx.propsValue.protect_content ?? false,
reply_to_message_id: ctx.propsValue.reply_to_message_id ?? undefined,
reply_markup: ctx.propsValue.reply_markup ?? undefined,
},
});
},
});