Вопросы по интеграции с Telegram Bot Api

  1. Как поставить чтобы на каждое сообщение от любого пользователя запускался Сценарий?

  2. Как отправить кнопку, в которой можно будет передать телефон боту?

Параметр (request_contact)

Здравствуйте! В триггере New Updates (Instant) включите в перечне Allowed Updates пункт messages и тогда он должен срабатывать при каждом входящем сообщении.

касаемо кнопки сейчас можно через код сделать

/** @CustomParams
{
  "accessToken": {
    "key": "accessToken",
    "title": "Telegram Bot Access Token",
    "type": "string"
  },
  "chat_id": {
    "key": "chat_id",
    "title": "Chat ID",
    "description": "ID чата, в который отправляется сообщение",
    "type": "string"
  },
  "message_text": {
    "key": "message_text",
    "title": "Message Text",
    "description": "Текст сообщения для отправки",
    "type": "string"
  },
  "button_text": {
    "key": "button_text",
    "title": "Button Text",
    "description": "Текст кнопки, запрашивающей контакт",
    "type": "string"
  }
}
*/
import axios from 'axios';

export default async function run({ data }) {
  try {
    const response = await axios.post(
      `https://api.telegram.org/bot${data.accessToken}/sendMessage`,
      {
        chat_id: data.chat_id,
        text: data.message_text,
        reply_markup: {
          keyboard: [
            [
              {
                text: data.button_text,
                request_contact: true,
              },
            ],
          ],
          resize_keyboard: true,
          one_time_keyboard: true,
        },
      },
      {
        headers: {
          'Content-Type': 'application/json',
        },
      }
    );
    return response.data;
  } catch (error) {
    if (error.response) {
      // Запрос был сделан, и сервер ответил статусным кодом, который выходит за пределы диапазона 2xx
      return {
        status: error.response.status,
        statusText: error.response.statusText,
        data: error.response.data,
      };
    } else if (error.request) {
      // Запрос был сделан, но ответа не было получено
      return {
        status: 500,
        message: 'No response received from Telegram API',
      };
    } else {
      // Произошла ошибка при настройке запроса
      return {
        status: 500,
        message: 'Error in setting up the request: ' + error.message,
      };
    }
  }
}