sendMessage
import { createAction, option } from '@typebot.io/forge' import { auth } from '../auth' import { got } from 'got' export const sendMessage = createAction({ auth, name: 'Send message', options: option.object({ chatId: option.string.layout({ label: 'Chat ID', placeholder: '@username', }), text: option.string.layout({ label: 'Message text', input: 'textarea', }), }), run: { server: async ({ credentials: { token }, options: { chatId, text } }) => { try { await got.post(`https://api.telegram.org/bot${token}/sendMessage`, { json: { chat_id: chatId, text, }, }) } catch (error) { console.log('ERROR', error.response.body) } }, }, })
Show properties
waitForEvent