Created
May 2, 2018 19:36
-
-
Save satwikkansal/7da9aeb4968678d2a1d0b926dc23aebb to your computer and use it in GitHub Desktop.
Creating persistent menu and get started button in C# (useful for ASP.net)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Snippet for persistent menu | |
var client = new RestClient("https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"); | |
var request = new RestRequest(Method.POST); | |
request.AddHeader("postman-token", "2f9a47e2-2a8a-0a70-c4ce-cb72dbfd8e93"); | |
request.AddHeader("cache-control", "no-cache"); | |
request.AddHeader("content-type", "application/json"); | |
request.AddParameter("application/json", "{\n \"setting_type\" : \"call_to_actions\",\n \"thread_state\" : \"existing_thread\",\n \"call_to_actions\":[\n {\n \"type\":\"postback\",\n \"title\":\"Help\",\n \"payload\":\"DEVELOPER_DEFINED_PAYLOAD_FOR_HELP\"\n },\n {\n \"type\":\"postback\",\n \"title\":\"Start a New Order\",\n \"payload\":\"DEVELOPER_DEFINED_PAYLOAD_FOR_START_ORDER\"\n },\n {\n \"type\":\"web_url\",\n \"title\":\"View Website\",\n \"url\":\"http://petersapparel.parseapp.com/\"\n }\n ]\n }", ParameterType.RequestBody); | |
IRestResponse response = client.Execute(request); | |
// Snippet for getting started button | |
var client = new RestClient("https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"); | |
var request = new RestRequest(Method.POST); | |
request.AddHeader("postman-token", "c1ace4b6-ed1c-1e58-73c5-2647beae089f"); | |
request.AddHeader("cache-control", "no-cache"); | |
request.AddHeader("content-type", "application/json"); | |
request.AddParameter("application/json", "{\n \"setting_type\":\"call_to_actions\",\n \"thread_state\":\"new_thread\",\n \"call_to_actions\":[\n { }\n]\n}", ParameterType.RequestBody); | |
IRestResponse response = client.Execute(request); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment