1

Please help, there is a web application from Telegram Web App in a chatbot, I click the MainButton to send a message using the WebApp.SendData() method, but I don't know how to process this data correctly in my backend

\`package main

import (
"log"
"os"
"time"

    tele "gopkg.in/telebot.v3"

)

func main() {
pref := tele.Settings{
Token:  os.Getenv("TOKEN"),
Poller: &tele.LongPoller{Timeout: 10 \* time.Second},
}

    b, err := tele.NewBot(pref)
    if err != nil {
        log.Fatal(err)
        return
    }
    
    b.Handle("/hello", func(c tele.Context) error {
        return c.Send("Hello!")
    })
    
    b.Start()

}\`

It turns out you need another b.Handle (WebAppData) in this code template, but I don't know how to properly describe the handling

https://github.com/tucnak/telebot/blob/v3/web_app.go

I've read the description here, but I don't have the brains to understand it

sandji
  • 11
  • 1

0 Answers0