Handover Protocol not passing thread ownership - But it brings “success” response - seems like Bug












0















I am trying to implement Messenger Handover Protocol for my messenger bot, but the Pass_Thread_Control is not handing over the ownership from Primary Receiver to Secondary Receiver (Inbox).



I have tried more than 100 times with different combinations before opening this thread. When User clicks on "Pass to Inbox" quick reply, the bot (Dialogflow integrated with Python) kicks the Webhook and do the following:




  1. Get the Facebook Page - Secondary Receiver (Inbox) ID & Thread Owner response (in general Primary receiver [FB App] is thread owner)

  2. Execute the Graph API Pass_Thread_Control with proper inputs {"success":true}

  3. Call the Graph API Thread Owner again & found that Primary Receiver is still thread owner (whereas it should be the Secondary Receiver which should be the thread owner)


As a result, the user message is not been transferred from Facebook Page "Done" folder to "Inbox" automatically.



Other Configuration:
[1] FB Page is subscribed to FB App
[2] Events selected for FB Page: messages, messaging_postbacks, messaging_handovers, standby, messaging_policy_enforcement
[3] FB Page --> Primary Receiver: FB APP, Secondary Receiver: Page Inbox



def human_control(req):

# GET ID OF INCOMING USER FROM WEBHOOK
id=req.get('originalDetectIntentRequest').get('payload').get('data').get('sender').get('id')

# CURRENT THREAD OWNER (BEFORE PASS_THREAD_CONTROL RUNS)

current_thread_owner = "https://graph.facebook.com/v2.6/me/thread_owner?recipient=" + id + "&access_token=" + ACCESS_TOKEN
result = urllib.request.urlopen(current_thread_owner).read()

# PASS_THREAD_CONTROL JSON Parameters:

target_payload = {
"recipient": {"id": id},
"target_app_id": "263902037430900",
"metadata": req.get('queryResult').get('queryText')
}

# PASS_THREAD_CONTROL - To Secondary Inbox - via Graph API call
# BELOW FORMAT WORKS ONLY IN PYTHON & BRINGS SUCCESS
# FB SUGGESTED WAY: https://developers.facebook.com/docs/messenger-platform/handover-protocol/pass-thread-control

pass_control_result = requests.post("https://graph.facebook.com/v2.6/" + id + "?pass_thread_control&access_token=" + ACCESS_TOKEN, params=target_payload)

# CURRENT THREAD OWNER (BEFORE PASS_THREAD_CONTROL RUNS)

current_thread_owner = "https://graph.facebook.com/v2.6/me/thread_owner?recipient=" + id + "&access_token=" + ACCESS_TOKEN
result = urllib.request.urlopen(current_thread_owner).read()

res = {
"payload": {
"facebook": {
"text": "Wait a while. Our Admin will be in touch shortly.",
"quick_replies": [
{
"content_type": "text",
"title": "Back to Bot",
"payload": "Back to Bot",
}
]
}
},
};
res = json.dumps(res, indent=4)
print (res)
r = make_response(res)
r.headers['Content-Type'] = 'application/json'
return r


Expected Result-->




  1. Current Thread Owner (Before Pass Thread Call) -> 214020109069642 (FB App which is the Primary Receiver)---->
    {'data': [{'thread_owner': {'app_id': '214020109069642'}}]}


  2. Pass Thread Control ---> {"success":true}


  3. Again Current Thread Owner ---> 263902037430900 (FB Page Inbox ID). Secondary Receiver should take over the role of Primary Receiver


  4. Pass Thread Control JSON Payload should be present in Webhook response



Actual Result -->




  1. Current Thread Owner (Before Pass Thread Call) -> 214020109069642 (FB App which is the Primary Receiver)
    {'data': [{'thread_owner': {'app_id': '214020109069642'}}]}----> Correct


  2. Pass Thread Control ---> {"success":true}--> Correct


  3. Again Current Thread Owner ---> 214020109069642 (FB App ID) ####After Running Pass Thread Control API, SECONDARY RECEIVER ID:263902037430900 | NAME: Page Inbox --> Wrong


  4. Pass Thread Control JSON Payload should be present in Webhook response --> Not Coming











share|improve this question























  • This works fine for me. You probably want to make sure you use a current API version for your calls (v2.6 had been deprecated), however that's probably not the reason for your actual issue. Besides the call to determine the current thread owner, does passing thread control to the inbox itself work? Do you see the conversation in the Inbox folder after you passed thread control to the Inbox?

    – lars.schwarz
    Jan 2 at 16:42











  • Thanks Lars for the review. I just tried with v3.2 (earlier tried it too) but it didn't work. Same result as before. I don't know what would I do. Also the payload is not coming from messenger response which is quite strange too. "pass_thread_control":{ "new_owner_app_id":"123456789", "metadata":"Additional content that the caller wants to set" }

    – Swap
    Jan 2 at 19:59


















0















I am trying to implement Messenger Handover Protocol for my messenger bot, but the Pass_Thread_Control is not handing over the ownership from Primary Receiver to Secondary Receiver (Inbox).



I have tried more than 100 times with different combinations before opening this thread. When User clicks on "Pass to Inbox" quick reply, the bot (Dialogflow integrated with Python) kicks the Webhook and do the following:




  1. Get the Facebook Page - Secondary Receiver (Inbox) ID & Thread Owner response (in general Primary receiver [FB App] is thread owner)

  2. Execute the Graph API Pass_Thread_Control with proper inputs {"success":true}

  3. Call the Graph API Thread Owner again & found that Primary Receiver is still thread owner (whereas it should be the Secondary Receiver which should be the thread owner)


As a result, the user message is not been transferred from Facebook Page "Done" folder to "Inbox" automatically.



Other Configuration:
[1] FB Page is subscribed to FB App
[2] Events selected for FB Page: messages, messaging_postbacks, messaging_handovers, standby, messaging_policy_enforcement
[3] FB Page --> Primary Receiver: FB APP, Secondary Receiver: Page Inbox



def human_control(req):

# GET ID OF INCOMING USER FROM WEBHOOK
id=req.get('originalDetectIntentRequest').get('payload').get('data').get('sender').get('id')

# CURRENT THREAD OWNER (BEFORE PASS_THREAD_CONTROL RUNS)

current_thread_owner = "https://graph.facebook.com/v2.6/me/thread_owner?recipient=" + id + "&access_token=" + ACCESS_TOKEN
result = urllib.request.urlopen(current_thread_owner).read()

# PASS_THREAD_CONTROL JSON Parameters:

target_payload = {
"recipient": {"id": id},
"target_app_id": "263902037430900",
"metadata": req.get('queryResult').get('queryText')
}

# PASS_THREAD_CONTROL - To Secondary Inbox - via Graph API call
# BELOW FORMAT WORKS ONLY IN PYTHON & BRINGS SUCCESS
# FB SUGGESTED WAY: https://developers.facebook.com/docs/messenger-platform/handover-protocol/pass-thread-control

pass_control_result = requests.post("https://graph.facebook.com/v2.6/" + id + "?pass_thread_control&access_token=" + ACCESS_TOKEN, params=target_payload)

# CURRENT THREAD OWNER (BEFORE PASS_THREAD_CONTROL RUNS)

current_thread_owner = "https://graph.facebook.com/v2.6/me/thread_owner?recipient=" + id + "&access_token=" + ACCESS_TOKEN
result = urllib.request.urlopen(current_thread_owner).read()

res = {
"payload": {
"facebook": {
"text": "Wait a while. Our Admin will be in touch shortly.",
"quick_replies": [
{
"content_type": "text",
"title": "Back to Bot",
"payload": "Back to Bot",
}
]
}
},
};
res = json.dumps(res, indent=4)
print (res)
r = make_response(res)
r.headers['Content-Type'] = 'application/json'
return r


Expected Result-->




  1. Current Thread Owner (Before Pass Thread Call) -> 214020109069642 (FB App which is the Primary Receiver)---->
    {'data': [{'thread_owner': {'app_id': '214020109069642'}}]}


  2. Pass Thread Control ---> {"success":true}


  3. Again Current Thread Owner ---> 263902037430900 (FB Page Inbox ID). Secondary Receiver should take over the role of Primary Receiver


  4. Pass Thread Control JSON Payload should be present in Webhook response



Actual Result -->




  1. Current Thread Owner (Before Pass Thread Call) -> 214020109069642 (FB App which is the Primary Receiver)
    {'data': [{'thread_owner': {'app_id': '214020109069642'}}]}----> Correct


  2. Pass Thread Control ---> {"success":true}--> Correct


  3. Again Current Thread Owner ---> 214020109069642 (FB App ID) ####After Running Pass Thread Control API, SECONDARY RECEIVER ID:263902037430900 | NAME: Page Inbox --> Wrong


  4. Pass Thread Control JSON Payload should be present in Webhook response --> Not Coming











share|improve this question























  • This works fine for me. You probably want to make sure you use a current API version for your calls (v2.6 had been deprecated), however that's probably not the reason for your actual issue. Besides the call to determine the current thread owner, does passing thread control to the inbox itself work? Do you see the conversation in the Inbox folder after you passed thread control to the Inbox?

    – lars.schwarz
    Jan 2 at 16:42











  • Thanks Lars for the review. I just tried with v3.2 (earlier tried it too) but it didn't work. Same result as before. I don't know what would I do. Also the payload is not coming from messenger response which is quite strange too. "pass_thread_control":{ "new_owner_app_id":"123456789", "metadata":"Additional content that the caller wants to set" }

    – Swap
    Jan 2 at 19:59
















0












0








0








I am trying to implement Messenger Handover Protocol for my messenger bot, but the Pass_Thread_Control is not handing over the ownership from Primary Receiver to Secondary Receiver (Inbox).



I have tried more than 100 times with different combinations before opening this thread. When User clicks on "Pass to Inbox" quick reply, the bot (Dialogflow integrated with Python) kicks the Webhook and do the following:




  1. Get the Facebook Page - Secondary Receiver (Inbox) ID & Thread Owner response (in general Primary receiver [FB App] is thread owner)

  2. Execute the Graph API Pass_Thread_Control with proper inputs {"success":true}

  3. Call the Graph API Thread Owner again & found that Primary Receiver is still thread owner (whereas it should be the Secondary Receiver which should be the thread owner)


As a result, the user message is not been transferred from Facebook Page "Done" folder to "Inbox" automatically.



Other Configuration:
[1] FB Page is subscribed to FB App
[2] Events selected for FB Page: messages, messaging_postbacks, messaging_handovers, standby, messaging_policy_enforcement
[3] FB Page --> Primary Receiver: FB APP, Secondary Receiver: Page Inbox



def human_control(req):

# GET ID OF INCOMING USER FROM WEBHOOK
id=req.get('originalDetectIntentRequest').get('payload').get('data').get('sender').get('id')

# CURRENT THREAD OWNER (BEFORE PASS_THREAD_CONTROL RUNS)

current_thread_owner = "https://graph.facebook.com/v2.6/me/thread_owner?recipient=" + id + "&access_token=" + ACCESS_TOKEN
result = urllib.request.urlopen(current_thread_owner).read()

# PASS_THREAD_CONTROL JSON Parameters:

target_payload = {
"recipient": {"id": id},
"target_app_id": "263902037430900",
"metadata": req.get('queryResult').get('queryText')
}

# PASS_THREAD_CONTROL - To Secondary Inbox - via Graph API call
# BELOW FORMAT WORKS ONLY IN PYTHON & BRINGS SUCCESS
# FB SUGGESTED WAY: https://developers.facebook.com/docs/messenger-platform/handover-protocol/pass-thread-control

pass_control_result = requests.post("https://graph.facebook.com/v2.6/" + id + "?pass_thread_control&access_token=" + ACCESS_TOKEN, params=target_payload)

# CURRENT THREAD OWNER (BEFORE PASS_THREAD_CONTROL RUNS)

current_thread_owner = "https://graph.facebook.com/v2.6/me/thread_owner?recipient=" + id + "&access_token=" + ACCESS_TOKEN
result = urllib.request.urlopen(current_thread_owner).read()

res = {
"payload": {
"facebook": {
"text": "Wait a while. Our Admin will be in touch shortly.",
"quick_replies": [
{
"content_type": "text",
"title": "Back to Bot",
"payload": "Back to Bot",
}
]
}
},
};
res = json.dumps(res, indent=4)
print (res)
r = make_response(res)
r.headers['Content-Type'] = 'application/json'
return r


Expected Result-->




  1. Current Thread Owner (Before Pass Thread Call) -> 214020109069642 (FB App which is the Primary Receiver)---->
    {'data': [{'thread_owner': {'app_id': '214020109069642'}}]}


  2. Pass Thread Control ---> {"success":true}


  3. Again Current Thread Owner ---> 263902037430900 (FB Page Inbox ID). Secondary Receiver should take over the role of Primary Receiver


  4. Pass Thread Control JSON Payload should be present in Webhook response



Actual Result -->




  1. Current Thread Owner (Before Pass Thread Call) -> 214020109069642 (FB App which is the Primary Receiver)
    {'data': [{'thread_owner': {'app_id': '214020109069642'}}]}----> Correct


  2. Pass Thread Control ---> {"success":true}--> Correct


  3. Again Current Thread Owner ---> 214020109069642 (FB App ID) ####After Running Pass Thread Control API, SECONDARY RECEIVER ID:263902037430900 | NAME: Page Inbox --> Wrong


  4. Pass Thread Control JSON Payload should be present in Webhook response --> Not Coming











share|improve this question














I am trying to implement Messenger Handover Protocol for my messenger bot, but the Pass_Thread_Control is not handing over the ownership from Primary Receiver to Secondary Receiver (Inbox).



I have tried more than 100 times with different combinations before opening this thread. When User clicks on "Pass to Inbox" quick reply, the bot (Dialogflow integrated with Python) kicks the Webhook and do the following:




  1. Get the Facebook Page - Secondary Receiver (Inbox) ID & Thread Owner response (in general Primary receiver [FB App] is thread owner)

  2. Execute the Graph API Pass_Thread_Control with proper inputs {"success":true}

  3. Call the Graph API Thread Owner again & found that Primary Receiver is still thread owner (whereas it should be the Secondary Receiver which should be the thread owner)


As a result, the user message is not been transferred from Facebook Page "Done" folder to "Inbox" automatically.



Other Configuration:
[1] FB Page is subscribed to FB App
[2] Events selected for FB Page: messages, messaging_postbacks, messaging_handovers, standby, messaging_policy_enforcement
[3] FB Page --> Primary Receiver: FB APP, Secondary Receiver: Page Inbox



def human_control(req):

# GET ID OF INCOMING USER FROM WEBHOOK
id=req.get('originalDetectIntentRequest').get('payload').get('data').get('sender').get('id')

# CURRENT THREAD OWNER (BEFORE PASS_THREAD_CONTROL RUNS)

current_thread_owner = "https://graph.facebook.com/v2.6/me/thread_owner?recipient=" + id + "&access_token=" + ACCESS_TOKEN
result = urllib.request.urlopen(current_thread_owner).read()

# PASS_THREAD_CONTROL JSON Parameters:

target_payload = {
"recipient": {"id": id},
"target_app_id": "263902037430900",
"metadata": req.get('queryResult').get('queryText')
}

# PASS_THREAD_CONTROL - To Secondary Inbox - via Graph API call
# BELOW FORMAT WORKS ONLY IN PYTHON & BRINGS SUCCESS
# FB SUGGESTED WAY: https://developers.facebook.com/docs/messenger-platform/handover-protocol/pass-thread-control

pass_control_result = requests.post("https://graph.facebook.com/v2.6/" + id + "?pass_thread_control&access_token=" + ACCESS_TOKEN, params=target_payload)

# CURRENT THREAD OWNER (BEFORE PASS_THREAD_CONTROL RUNS)

current_thread_owner = "https://graph.facebook.com/v2.6/me/thread_owner?recipient=" + id + "&access_token=" + ACCESS_TOKEN
result = urllib.request.urlopen(current_thread_owner).read()

res = {
"payload": {
"facebook": {
"text": "Wait a while. Our Admin will be in touch shortly.",
"quick_replies": [
{
"content_type": "text",
"title": "Back to Bot",
"payload": "Back to Bot",
}
]
}
},
};
res = json.dumps(res, indent=4)
print (res)
r = make_response(res)
r.headers['Content-Type'] = 'application/json'
return r


Expected Result-->




  1. Current Thread Owner (Before Pass Thread Call) -> 214020109069642 (FB App which is the Primary Receiver)---->
    {'data': [{'thread_owner': {'app_id': '214020109069642'}}]}


  2. Pass Thread Control ---> {"success":true}


  3. Again Current Thread Owner ---> 263902037430900 (FB Page Inbox ID). Secondary Receiver should take over the role of Primary Receiver


  4. Pass Thread Control JSON Payload should be present in Webhook response



Actual Result -->




  1. Current Thread Owner (Before Pass Thread Call) -> 214020109069642 (FB App which is the Primary Receiver)
    {'data': [{'thread_owner': {'app_id': '214020109069642'}}]}----> Correct


  2. Pass Thread Control ---> {"success":true}--> Correct


  3. Again Current Thread Owner ---> 214020109069642 (FB App ID) ####After Running Pass Thread Control API, SECONDARY RECEIVER ID:263902037430900 | NAME: Page Inbox --> Wrong


  4. Pass Thread Control JSON Payload should be present in Webhook response --> Not Coming








python-3.x facebook-graph-api flask






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 7:14









SwapSwap

63




63













  • This works fine for me. You probably want to make sure you use a current API version for your calls (v2.6 had been deprecated), however that's probably not the reason for your actual issue. Besides the call to determine the current thread owner, does passing thread control to the inbox itself work? Do you see the conversation in the Inbox folder after you passed thread control to the Inbox?

    – lars.schwarz
    Jan 2 at 16:42











  • Thanks Lars for the review. I just tried with v3.2 (earlier tried it too) but it didn't work. Same result as before. I don't know what would I do. Also the payload is not coming from messenger response which is quite strange too. "pass_thread_control":{ "new_owner_app_id":"123456789", "metadata":"Additional content that the caller wants to set" }

    – Swap
    Jan 2 at 19:59





















  • This works fine for me. You probably want to make sure you use a current API version for your calls (v2.6 had been deprecated), however that's probably not the reason for your actual issue. Besides the call to determine the current thread owner, does passing thread control to the inbox itself work? Do you see the conversation in the Inbox folder after you passed thread control to the Inbox?

    – lars.schwarz
    Jan 2 at 16:42











  • Thanks Lars for the review. I just tried with v3.2 (earlier tried it too) but it didn't work. Same result as before. I don't know what would I do. Also the payload is not coming from messenger response which is quite strange too. "pass_thread_control":{ "new_owner_app_id":"123456789", "metadata":"Additional content that the caller wants to set" }

    – Swap
    Jan 2 at 19:59



















This works fine for me. You probably want to make sure you use a current API version for your calls (v2.6 had been deprecated), however that's probably not the reason for your actual issue. Besides the call to determine the current thread owner, does passing thread control to the inbox itself work? Do you see the conversation in the Inbox folder after you passed thread control to the Inbox?

– lars.schwarz
Jan 2 at 16:42





This works fine for me. You probably want to make sure you use a current API version for your calls (v2.6 had been deprecated), however that's probably not the reason for your actual issue. Besides the call to determine the current thread owner, does passing thread control to the inbox itself work? Do you see the conversation in the Inbox folder after you passed thread control to the Inbox?

– lars.schwarz
Jan 2 at 16:42













Thanks Lars for the review. I just tried with v3.2 (earlier tried it too) but it didn't work. Same result as before. I don't know what would I do. Also the payload is not coming from messenger response which is quite strange too. "pass_thread_control":{ "new_owner_app_id":"123456789", "metadata":"Additional content that the caller wants to set" }

– Swap
Jan 2 at 19:59







Thanks Lars for the review. I just tried with v3.2 (earlier tried it too) but it didn't work. Same result as before. I don't know what would I do. Also the payload is not coming from messenger response which is quite strange too. "pass_thread_control":{ "new_owner_app_id":"123456789", "metadata":"Additional content that the caller wants to set" }

– Swap
Jan 2 at 19:59














1 Answer
1






active

oldest

votes


















0














I think I have resolved the issue. This is not a bug. Rather a parameter was not passing (headers) in here causing the wrong response here. I'm sorry for such a silly mistake (& wasting 3 days over it). Below is the right syntax:



headers = {'Content-type': 'application/json'}

target_payload = {
"recipient": {"id": id},
"target_app_id": target_inbox_id ,
"metadata": req.get('queryResult').get('queryText')
}

pass_control_result = requests.post("https://graph.facebook.com/v3.2/me/pass_thread_control?access_token=" + ACCESS_TOKEN, data=json.dumps(target_payload), headers=headers)


Just one query:
Once the bot stands by (Human talks with user from Inbox), it is not responding to chat command to take control of thread (eg: if user clicks on "back to bot" button, the bot remains silent in standby mode & no webhook response generated further).



Only "Mark as done" click enables the bot again.
Is there any way the user can call for thread control by bot again (without the Admin clicks on "Mark as done")? Since it is not responding to any command, calling "Request Thread Owner" or "Take Thread Control" API not working also.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54002584%2fhandover-protocol-not-passing-thread-ownership-but-it-brings-success-respons%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I think I have resolved the issue. This is not a bug. Rather a parameter was not passing (headers) in here causing the wrong response here. I'm sorry for such a silly mistake (& wasting 3 days over it). Below is the right syntax:



    headers = {'Content-type': 'application/json'}

    target_payload = {
    "recipient": {"id": id},
    "target_app_id": target_inbox_id ,
    "metadata": req.get('queryResult').get('queryText')
    }

    pass_control_result = requests.post("https://graph.facebook.com/v3.2/me/pass_thread_control?access_token=" + ACCESS_TOKEN, data=json.dumps(target_payload), headers=headers)


    Just one query:
    Once the bot stands by (Human talks with user from Inbox), it is not responding to chat command to take control of thread (eg: if user clicks on "back to bot" button, the bot remains silent in standby mode & no webhook response generated further).



    Only "Mark as done" click enables the bot again.
    Is there any way the user can call for thread control by bot again (without the Admin clicks on "Mark as done")? Since it is not responding to any command, calling "Request Thread Owner" or "Take Thread Control" API not working also.






    share|improve this answer




























      0














      I think I have resolved the issue. This is not a bug. Rather a parameter was not passing (headers) in here causing the wrong response here. I'm sorry for such a silly mistake (& wasting 3 days over it). Below is the right syntax:



      headers = {'Content-type': 'application/json'}

      target_payload = {
      "recipient": {"id": id},
      "target_app_id": target_inbox_id ,
      "metadata": req.get('queryResult').get('queryText')
      }

      pass_control_result = requests.post("https://graph.facebook.com/v3.2/me/pass_thread_control?access_token=" + ACCESS_TOKEN, data=json.dumps(target_payload), headers=headers)


      Just one query:
      Once the bot stands by (Human talks with user from Inbox), it is not responding to chat command to take control of thread (eg: if user clicks on "back to bot" button, the bot remains silent in standby mode & no webhook response generated further).



      Only "Mark as done" click enables the bot again.
      Is there any way the user can call for thread control by bot again (without the Admin clicks on "Mark as done")? Since it is not responding to any command, calling "Request Thread Owner" or "Take Thread Control" API not working also.






      share|improve this answer


























        0












        0








        0







        I think I have resolved the issue. This is not a bug. Rather a parameter was not passing (headers) in here causing the wrong response here. I'm sorry for such a silly mistake (& wasting 3 days over it). Below is the right syntax:



        headers = {'Content-type': 'application/json'}

        target_payload = {
        "recipient": {"id": id},
        "target_app_id": target_inbox_id ,
        "metadata": req.get('queryResult').get('queryText')
        }

        pass_control_result = requests.post("https://graph.facebook.com/v3.2/me/pass_thread_control?access_token=" + ACCESS_TOKEN, data=json.dumps(target_payload), headers=headers)


        Just one query:
        Once the bot stands by (Human talks with user from Inbox), it is not responding to chat command to take control of thread (eg: if user clicks on "back to bot" button, the bot remains silent in standby mode & no webhook response generated further).



        Only "Mark as done" click enables the bot again.
        Is there any way the user can call for thread control by bot again (without the Admin clicks on "Mark as done")? Since it is not responding to any command, calling "Request Thread Owner" or "Take Thread Control" API not working also.






        share|improve this answer













        I think I have resolved the issue. This is not a bug. Rather a parameter was not passing (headers) in here causing the wrong response here. I'm sorry for such a silly mistake (& wasting 3 days over it). Below is the right syntax:



        headers = {'Content-type': 'application/json'}

        target_payload = {
        "recipient": {"id": id},
        "target_app_id": target_inbox_id ,
        "metadata": req.get('queryResult').get('queryText')
        }

        pass_control_result = requests.post("https://graph.facebook.com/v3.2/me/pass_thread_control?access_token=" + ACCESS_TOKEN, data=json.dumps(target_payload), headers=headers)


        Just one query:
        Once the bot stands by (Human talks with user from Inbox), it is not responding to chat command to take control of thread (eg: if user clicks on "back to bot" button, the bot remains silent in standby mode & no webhook response generated further).



        Only "Mark as done" click enables the bot again.
        Is there any way the user can call for thread control by bot again (without the Admin clicks on "Mark as done")? Since it is not responding to any command, calling "Request Thread Owner" or "Take Thread Control" API not working also.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 4 at 8:18









        SwapSwap

        63




        63
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54002584%2fhandover-protocol-not-passing-thread-ownership-but-it-brings-success-respons%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith