Telegram bot creation to deployment in minutes

Telegram bot creation to deployment in minutes

Howdy everyone , hope everyone doin good . I always wanted to use telegram's webhooks feature for a very long time for my bot account i created like for a very long time for realtime replies , but for that u need a live site which accepts POST request.

This presented me with a few options
1) use cloudflare functions / pages
2) use a VPS solution like hostinger or google's free vm service
3) orrrr .... what if i can use cloudflare tunnel and my PI and ... i guess u understood where this is going

DIY TIME BABY !!!!!!!!!

okay now i am lazy soooo i am not going to create docker file and have a repository automate build and setup a webhook for automated deploy and all that stuff! . Every goddam tutorial and how to guide does this . No I need a easy solution ! I searched coolify's pre available "Resources" for automations

So there are a few services

1) Activepieces:
A no-code platform which is mostly free and has a lot of built in plugins's and blocks (but unfortunately for me the telegram plugin did not work as expected) and the tool was no code so it was a lot of drag and drops for a simple if else

2) N8N
A no-code platform which is kinda free and a hell lot of plugins but as i gather it has pay-walled a lot of simple features . Sooo its a no no

3) Jenkins
Yay literal lab for all kind of frankenstein's monster abominations in it . It is a low code and highly supported tool but still it lacks outright webhook as a feature . Now now calm down yes jenkins job's can have webhooks but its not like i can have a very custom webhook which is customized up right to the headers for my requirement at-least the auth must be in the headers . Which makes it a valid choice but ehhh a lil inconvenience acc to me.

4) Windmill
As part of my day job I have heard this being used in my company , curious i tried ! well well seems like it has no code , low code and drag drop app creation all of which can be exposed as endpoints and mainly they accept triggers as web hooks with auth in the url as a parameter . Sooo seems like a valid competitor to jenkins.

So the choice was between jenkins and windmill and I chose windmill just for the thrills of playing with a new tool. I deployed it and configured cloudflare tunnel to work with it . And behold it had examples of how to use it with all type of integrations

My windmill setup with my two automations

Now the beauty of windmill is it supports deno out of the box and deno supports npm out of the box ........ yes yes yes the power the powerrrrrrrrrrrrr

So i gear up and create a flow which looks somthing like this

Trigger is a webhook which as u can guess is a POST endpoint which accepts telegram's message json

{
  "message": {
    "from": {
      "is_bot": false,
      "username": "",
      "first_name": "",
      "language_code": ""
    },
    "chat": {
      "type": "",
      "username": "",
      "first_name": ""
    },
    "text": ""
  }
}

Fun fun now all I need to do is parse the text field and send a reply to it

Now before that i need to have a if else to filter what texts i process so I added a branch , which accepts values from input as parameters

Select which variable to process and add in the predicament is JS syntax.

Then u can add a inline js block and write in the code for processing in it

and repeat it for the final reply to telegram code logic at the end and save as draft and deploy it ( which deploy's the last saved draft ) . Bada boom bada bish i have a webhook based telegram bot . Thats it that was it . No docker no git no npm install no deno build or noo dns entry thats it the app is now live. I love windmill man i went bonkers this literally took me an hour to setup . And all I had to do to register my webhook was

curl -F "url=https://<YOURDOMAIN.EXAMPLE>/<WEBHOOKLOCATION>" https://api.telegram.org/bot<YOURTOKEN>/setWebhook

from here . Now i can totally skip most of the steps in that because the certificates are handled by cloudflare . Now everything is setup and when i text i receive replies from my bot yes yes it works just like that . Well my dear readers congratulations ur imagination is the limit now . Go wild