Answer the question
In order to leave comments, you need to log in
How to properly pack json to pass the keyboard?
Here is my send message function, how to correctly pass "inline_keyboard"?
func Sendmessage(message string, chatID int,b *Bot){
response := fmt.Sprintf("%s%s/sendMessage",b.Base_url,b.Token)
var test = "{inline_keyboard:{\"text\":\"hello\",\"url\":\"ya.ru\"}"
answer := map[string]interface{}{"chat_id":chatID,"text":message,"reply_markup":test}
mapAnswer, _ := json.Marshal(answer)
networkRequest.ProxyPost(response,string(mapAnswer))
}
Answer the question
In order to leave comments, you need to log in
It's best to create a type for Inline keyboard and marshal from it
type InlineKeyboard [][]InlineKeyboardButton
type InlineKeyboardButton struct {
Text string
Url string
CallbackData interface{}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question