How to create a Telegram Bot that interacts with a spreadsheet (Part 1 of 3)

Поделиться
HTML-код
  • Опубликовано: 2 авг 2024
  • EDIT: I wrote a new Medium post detailing how this works: bit.ly/3gLLxDt
    ---
    Part 1: Creating a telegram bot
    Part 2: Getting our bot to place values inside a cell in a Spreadsheet and getting the sheet to send back values to our bot when we send in some key words
    Part 3: Creating inline keyboard inside our bot so we won't need to send in keywords but instead, just press buttons
    Mainly dedicate this tutorial to everyone who's been reaching out to me about my Medium post. I hope this helps! And if there are technical concepts in this video that you think you can explain better to your fellow viewers, please share in the comments. It would be much appreciated :)
    P.S- Thanks to Wim for the foundational tutorial on Telegram Inline Keyboards. You may check it out for extra resources at / @wimscodingsecrets265

Комментарии • 101

  • @noneedtoknowaname8199
    @noneedtoknowaname8199 3 года назад +1

    Thank you Mars, this is exactly the bot I wanted to build. So happy I found your course!

  • @heitorvida5260
    @heitorvida5260 3 года назад

    This is brilliant and right what I needed. Thanks Mars!

  • @iamyen2
    @iamyen2 3 года назад

    Thanks for your sharing! It's clear and it works~

  • @allancfc2818
    @allancfc2818 4 года назад

    thank you for your tutorial!

  • @marsescobin
    @marsescobin  4 года назад +2

    Hi all! I wrote a new Medium post detailing how this works: bit.ly/3gLLxDt

  • @dwiantoro4011
    @dwiantoro4011 4 года назад +2

    Usefull for Newbie like me. Thank You.... :)

  • @krisriley2206
    @krisriley2206 2 года назад +1

    This is a great tutorial.
    How do you add the bot to a Telegram group?

  • @014ylrezeb
    @014ylrezeb 2 года назад +1

    i dont get the last part... it says i need do get where you only use do post.. and i dont know what you did at the last part because it was cut on the screen

  • @Alberto-dt1ip
    @Alberto-dt1ip 3 года назад +1

    Hii , I'm an industrial engineer and I'm interesting in develop one bot to track data from an excel worksheet. Do you have any idea where should I start? I don't have knowledge about programming.

  • @lordheman7974
    @lordheman7974 4 года назад

    Life is too short and you are so smart....LOL

  • @praveenbhargava9667
    @praveenbhargava9667 2 года назад +7

    I jus followed your instructions and created scrip. It looks like i configured the script exactly the same but I am unable to get the response.

    • @irannasir
      @irannasir Год назад

      Same here. Did you end up finding the solution

  • @syazwanaariffin6905
    @syazwanaariffin6905 2 года назад

    Thank you so much

  • @obitelsem
    @obitelsem 2 года назад

    Thanks!

  • @johandebruyn3533
    @johandebruyn3533 4 года назад +1

    Hi when I run the function doPost the script Editor generates this error message TypeError: Cannot read property 'postData' of undefined (line 23, file "Code") how fix please

  • @rafaelbertasso3254
    @rafaelbertasso3254 4 года назад

    Excellent video! But I cant find the code in Medium post

  • @NamNguyen-ih8oe
    @NamNguyen-ih8oe 2 года назад

    thanks for video. I was code like you, but when I run, google Appscript says: "TypeError: Cannot read property 'postData' of undefined (line 17, file "Code")"

  • @srinithinachiyar4755
    @srinithinachiyar4755 2 года назад +1

    Hi. Does this only work for Google Suite or it works for even normal account? I did everything but i get no reply from the telegram bot. I tried everything. I even rerunned the webhook but it still did not work. please help

  • @almadanimart3534
    @almadanimart3534 4 года назад

    hi, can this method applied in a group ?

  • @Exammap
    @Exammap 2 года назад

    How can I send my spreadsheet message to my telegram channel or bot. Please make a video on it.

  • @MarioBarretta
    @MarioBarretta 2 года назад

    Thnak You
    How to publish on telegram the info received on a google sheet?

  • @sheenng
    @sheenng 4 года назад

    Can this be done for fb messenger or whatsapp?

  • @Honestgamer69
    @Honestgamer69 4 года назад +1

    At 21:39, i cant see what is on top the link, and i lose it from there, and what is the Json Parser online for?newbie here

    • @marsescobin
      @marsescobin  4 года назад +2

      Hi! I deleted the Webhook by api.telegram.org/bot + /deleteWebhook and then I typed out api.telegram.org/bot + /getUpdates
      You can re-set the webhook by running the setWebhook function on your google app script (click "Run", beside "View")

  • @vijaykarthik1529
    @vijaykarthik1529 3 года назад

    Pls make video about how to create bot for share market price

  • @tomcunningham8935
    @tomcunningham8935 3 года назад +2

    Can you release the source code for the bot you've made?

  • @rimaldz8232
    @rimaldz8232 2 года назад

    hi mars
    i have problem
    ReferenceError: webAppUrl is not defined (ligne 6, fichier "Code")
    how i can fix §§

  • @gautamandani547
    @gautamandani547 6 месяцев назад

    Important where i got stuck,
    after deploying select the deployment script url and paste it in webapp, run the program (which will set the webhook of telegram to the current deployed script)

  • @mariodragoti4235
    @mariodragoti4235 3 года назад

    how i can create a bot to post autopost on group

  • @thestudentsperspective5822
    @thestudentsperspective5822 Год назад

    can you please link it to your source code

  • @ilyasulaimandali2210
    @ilyasulaimandali2210 4 года назад +2

    Hello, thanks for the great video however I can't get my bot to send texts back, everything worked fine up to the JSON Parsor Online. what could be the problem?

    • @marsescobin
      @marsescobin  4 года назад +1

      Make sure you run "set webhook" :) You can do this by clicking "Run" and choosing a function. It's beside "View"

    • @mohdsyazwan299
      @mohdsyazwan299 4 года назад +2

      @@marsescobin I followed your steps, same result. my bot not texts me back

    • @ilyasulaimandali2210
      @ilyasulaimandali2210 4 года назад

      @@marsescobin The test web app says doGet function not found and when I change doPost to doGet it couldnt read the variable contents. Thanks for the quick reply before!

    • @hazmiemohd7089
      @hazmiemohd7089 4 года назад

      @@mohdsyazwan299 same here

    • @viganboy126
      @viganboy126 4 года назад

      @@hazmiemohd7089 change : var id = contents.message.from.id to var id = contents.message.chat.id , u will get error 400 if use id from, the bot can't find the chat id to send message respon CMIIW

  • @farihaazmi4425
    @farihaazmi4425 4 года назад +3

    hey Mars Escobin . I already run it as set webhook and still my bot dont text me back. may i know why ?

    • @nizzuan2
      @nizzuan2 4 года назад

      I did delete the webhook and then run "set webhook" and it works

    • @carlospalma4327
      @carlospalma4327 4 года назад +1

      @@nizzuan2 IT DOESNT WORK

    • @AlbertodeVictoria
      @AlbertodeVictoria 3 года назад

      restart the webhook and create another implmentation

  • @mostu1009
    @mostu1009 4 месяца назад

    Take Me To Mars < Thanks

  • @VirgoINFP
    @VirgoINFP 2 года назад

    Doesn't work for me. I didn't recieved a message back in telegram.
    I try debugging by running the sendMessage function alone. I get an error message of "TypeError: Cannot read property 'postData' of undefined"

  • @zzhkszz
    @zzhkszz 4 года назад

    I stuck at 12:38 ,i press run as you do, but it show “exception: bad request: (line 8, file “Code”)

    • @marsescobin
      @marsescobin  4 года назад

      Sounds like there is a syntax error in the code?

  • @rukoh4980
    @rukoh4980 7 месяцев назад

    hey so since the UI change of the script editor there appears to be one key difference in the way projects are deployed and it may just make this impossible? when deploying it seems the fact that every time i deploy it, a new webapp url is generated for that deployment so when it calls upon the webAppUrl variable, its the webAppUrl of the previous now nonexistant deployment as opposed to the current one. seems like such a niche thing that im not really sure how to find a solution for this? doesnt seem to be a way to make it not do this...

    • @rukoh4980
      @rukoh4980 7 месяцев назад

      even copypasting the code in the article and changing the token and url to my bot and my webapp url, i cant get it to do anything

    • @rukoh4980
      @rukoh4980 7 месяцев назад

      found a function that fetches the url of the webapp and returns the /dev one which i think is supposed to act the same as the /exec one except it doesnt change each update? replaced it with that but it still hasnt done anything. including the logger.log thing in the function defining sendMessage() where it is in the finished example in the linked article returns nothing in the logs but having it in the setWebhook() one does.
      im a novice at coding but its really giving me a headache trying to see what the issue is. this is a 3 year old video so could it be the release of the runtime V8 im seeing people talk about a lot around 2022 in the forums? i just cant figure out what that couldve changed that would affect this..

  • @intanwadiahabdulrahman9469
    @intanwadiahabdulrahman9469 4 года назад +1

    I want ask you, i was finished until sendMessage and at time 21.30 in your video i trying to use that url and i got error 404, when i using setWebhook, i got webhook was deleted. I can't see what are you doing after that, so could you teach me how to solve it?

    • @marsescobin
      @marsescobin  4 года назад +2

      Hi! I deleted the Webhook by typing api.telegram.org/bot + /deleteWebhook and then I typed out api.telegram.org/bot + /getUpdates
      You can re-set the webhook by running the setWebhook function on your google app script (click "Run", beside "View")

    • @intanwadiahabdulrahman9469
      @intanwadiahabdulrahman9469 4 года назад

      @@marsescobin thanks a lot
      By the way, how did you got an id?

  • @andreabezio
    @andreabezio 4 года назад

    Very useful thanks! But sadly im not able to open the Script on google sheets for some reason. It says "unable to open the file in this moment, verify your link and retry"... I don't really know whats the problem.

    • @marsescobin
      @marsescobin  4 года назад +1

      Glad its helpful! Yes that randomly happens to me as well :( try using another browser or clearing your cache

    • @andreabezio
      @andreabezio 4 года назад

      @@marsescobin Changing browser worked thx! :)

    • @JG-bj1js
      @JG-bj1js Год назад

      What browser did you use?

  • @bryanling626
    @bryanling626 4 года назад +1

    i tried rerunning the webhook but didn’t get any reply from the bot

  • @popzmickuumickuu7504
    @popzmickuumickuu7504 3 года назад

    How can i get code of this

  • @taufanali3170
    @taufanali3170 4 года назад

    Hello, I tried to replicate what you did. I cannot get response from Apps Script. When I tried to do /getWebhookInfo, it says that the latest status is error 401, unauthorized. I have deployed it to accessible to anyone (even anonymous). Do you know how to fix that?

    • @marsescobin
      @marsescobin  4 года назад

      Hello! Make sure your webhook is working by rerunning set webhook function

  • @marufjonmamatkulov1572
    @marufjonmamatkulov1572 2 года назад

    in final, my cod is not working

  • @zhongyinghew9820
    @zhongyinghew9820 4 года назад +3

    Unable to get bot to response , tried all the method mentioned below

    • @zhongyinghew9820
      @zhongyinghew9820 4 года назад +3

      Having error when run doPost : TypeError: Cannot read property 'postData' of undefined (line 18, file "Code")

    • @lordheman7974
      @lordheman7974 4 года назад +1

      Me to let know if you resolved

    • @LuJiale
      @LuJiale 4 года назад

      @@lordheman7974 Hi, I faced the same problem but I found the remedy to it.
      1) Perform the /deleteWebhook
      2) setWebhook through the "run" button
      3) Publish -> Deploy as webapp -> Project Version -> new -> Update
      This works for me.

  • @senchaichow2193
    @senchaichow2193 7 месяцев назад

    I cant get it also

  • @eugenechristopher7909
    @eugenechristopher7909 3 года назад

    Hi - Is it possible for telegram to retrieve data from google sheets?

    • @AlbertodeVictoria
      @AlbertodeVictoria 3 года назад

      your variable 'text' need to be a getRange().getValue() method

    • @sanjeevdosi4983
      @sanjeevdosi4983 3 года назад

      @@AlbertodeVictoria i need my bot to read cells in a given range and also certain highlighted text in the spreadsheet. I do not want my bot and it users to make any changes in my original spreadsheet. If you could kindly send me the appropriate code lines and the exact place to insert them in the entire code. Regards

  • @tyr731
    @tyr731 2 года назад

    TypeError: Cannot read property 'postData' of undefined it doesn't identify post data i think your coding is wrong not working

  • @gigibiruful
    @gigibiruful 4 года назад +2

    Followed everything but no response..

    • @marsescobin
      @marsescobin  4 года назад +1

      Hello! Make sure your webhook is working by rerunning set webhook function

  • @nathgomez936
    @nathgomez936 3 года назад

    i followed the instruction but the bot no response. :3

  • @nyujinseu722
    @nyujinseu722 4 года назад +4

    Hi!! So i tried the deleteWebhook, and running it again. But my bot still does not respond to me. I have an error which says TypeError: Cannot read property ‘postData’ of undefined (line 16)

    • @AlbertodeVictoria
      @AlbertodeVictoria 3 года назад

      you need a new implementation whe you restar the webhook

  • @wimscodingsecrets4558
    @wimscodingsecrets4558 3 года назад +1

    Hi Mars, very nice tutorial. Could you mention my video as a source? (assuming you had me as the inspiration)

  • @alchemist9812
    @alchemist9812 3 года назад

    How do u fix an error 400?

    • @clintonmak4294
      @clintonmak4294 3 года назад

      not sure if u still need it. i fixed mine by replacing the google app url to the latest whenever i published

  • @sarahhasran
    @sarahhasran 4 года назад

    My bot doesn't response to me :')

    • @marsescobin
      @marsescobin  4 года назад

      It's very likely that it's because the setWebhook function got deleted and was not set back.Just run the function by clicking "Run" beside "View"

  • @user-rt5sm3cd5s
    @user-rt5sm3cd5s 7 месяцев назад

    damn difficult, is it for beginners? the learning curve is so steep

  • @eliastan1098
    @eliastan1098 3 года назад +1

    Hi, I am unable to have the bot send me back a message even after setting back the web hook.

    • @jacksonl7930
      @jacksonl7930 3 года назад

      hi i also encounter this problem do remember to check your webAppUrl, redeployment may cause new url to appear

    • @eliastan1098
      @eliastan1098 3 года назад

      @@jacksonl7930 doesn't that mean you need to change the webapp url and redeploy again if the link is different? That doesn't make sense, it would be like an infinite loop of changing webapp url and redeployment again and again wouldn't it?

    • @jacksonl7930
      @jacksonl7930 3 года назад +1

      I just started learning about it today, but somehow it works for me

    • @eliastan1098
      @eliastan1098 3 года назад

      @@jacksonl7930 alright ill give it a shot

  • @shakilabanu7866
    @shakilabanu7866 3 года назад

    You should explain right from telegram installation, creation of an account, sending receiving the messages... forming the group , what is bot.... usage of this one and what is broadcasting , then the channel what purpose, it function and how to use the channel ... further usage of it for business communication also

  • @hbsr5212
    @hbsr5212 3 года назад

    @Mars Escobin - Great Videos. Do you have an email address that you would like to provide for additional questions?