2016-10-05 2 views
0

Как я могу поместить кнопку запуска как ту же самую в ботях facebook? Я проверил документацию на facebook, и я говорю, что мне нужно позвонить в службу facebook, но я не понял этого. Это URL-адрес документации.Кнопка «Начать» на facebook bot с рамкой бота

https://developers.facebook.com/docs/messenger-platform/thread-settings

ответ

1

Посмотрите this issue в BotBuilder GitHub, где это обсуждалось. Ниже код из этого потока:

app.js

var request = require('request'); 

//========================================================= 
// Facebook setup // Run only when need updating. 
//========================================================= 

// Set FB bot greeting text 
facebookThreadAPI('./fb-greeting-text.json', 'Greating Text'); 
// Set FB bot get started button 
facebookThreadAPI('./fb-get-started-button.json', 'Get Started Button'); 
// Set FB bot persistent menu 
facebookThreadAPI('./fb-persistent-menu.json', 'Persistent Menu'); 

// Calls the Facebook graph api to change various bot settings 
function facebookThreadAPI(jsonFile, cmd){ 
    // Start the request 
    request({ 
     url: 'https://graph.facebook.com/v2.6/me/thread_settings?access_token='+process.env.FB_PAGE_ACCESS_TOKEN, 
     method: 'POST', 
     headers: {'Content-Type': 'application/json'}, 
     form: require(jsonFile) 
    }, 
    function (error, response, body) { 
     if (!error && response.statusCode == 200) { 
      // Print out the response body 
      console.log(cmd+": Updated."); 
      console.log(body); 
     } else { 
      // TODO: Handle errors 
      console.log(cmd+": Failed. Need to handle errors."); 
      console.log(body); 
     } 
    }); 
} 

фб-приветственное text.json

{ 
    "setting_type":"greeting", 
    "greeting":{ 
    "text":"Your greeting text here." 
    } 
} 

FB-Get-начала-button.json

{ 
    "setting_type":"call_to_actions", 
    "thread_state":"new_thread", 
    "call_to_actions":[ 
    { 
     "payload":"action?POSTBACKHERE" 
    } 
    ] 
} 

фб-стойкие-menu.json

// Just using the menu to do a single button admin reset 
{ 
    "setting_type" : "call_to_actions", 
    "thread_state" : "existing_thread", 
    "call_to_actions":[ 
    { 
     "type":"postback", 
     "title":"Admin Reset", 
     "payload":"action?POSTBACKHERE" 
    } 
    ] 
} 
+2

Можно ли сделать с C#. Можете ли вы мне помочь? –

Смежные вопросы