2016-07-08 47 views
-2

我正在使用MS Bot框架,並希望在通過文檔和一些相關問題後,我在電報中顯示了一些內聯按鈕,但在session.send(temp)後我寫了'在通道上沒有任何按鈕。無法獲得電報內聯按鈕的工作

var temp = { 
"type": "Message", 
"from": { "channelID":"telegram", "address": session.message.from.id}, 
"to": { "channelID":"telegram", "address": session.message.to.id}, 
"conversationId": session.message.conversationId, 
"channelData": { 
    "method": "editMessageReplyMarkup", 
    "parameters": { 
     "message_id": session.message.id, 
      "reply_markup": { 
       "inline_keyboard": [ 
        [{"text": "Show me more options", "callback_data": "next"}], 
        [{"text": "Start a new search", "callback_data": "quit"}] 
       ] 
      } 
     } 
    } 
}; 
session.send(temp); 
+0

請解釋「它似乎不工作」。 – aksappy

回答

0

按鈕在BotFramework中本地支持,因此您不需要使用ChannelData。 (See Docs

"buttons": 
[ 
    { 
     "type": "imBack", 
     "title": "Show me more options", 
     "value": "next" 
    }, 
    { 
     "type": "imBack", 
     "title": "Start a new search", 
     "value": "quit" 
    } 
] 
0

如果你確實想通過channelData實現這一目標,就必須字符串化的reply_markup字段的值,例如:

"reply_markup": JSON.stringify({ 
      "inline_keyboard": [ 
       [{"text": "Show me more options", "callback_data": "next"}], 
       [{"text": "Start a new search", "callback_data": "quit"}] 
      ] 
     })