Get Thread Owner

Open Beta

This feature is currently in open beta, and is subject to change. While we do not anticipate any significant changes during the beta period, we will announce any changes in this doc and in the Messenger Platform changelog.

The handover protocol's Thread Owner API returns the app ID of the app the currently has thread control for a Page. This is useful for bots that have complex implementations of the handover protocol, where an app's actions are dependent on whether it currently has thread control.

The Thread Owner API may be called by apps with the Primary Receiver and the Secondary receiver app roles.

Contents

Permission by App Role

If the app calling the Thread Owner API has the Primary Receiver role, the API will always return the app ID of the current thread owner.

If the calling app has the Secondary Receiver role, the API will only return the app ID of the current thread owner if it or the Primary Receiver app is the owner. If a different Secondary Receiver app has thread control, the following error will be returned:

{
  "error": {
    "message": "(#100) Denying visibility of any secondary receiver to another secondary receiver other than itself.",
    "type":"OAuthException",
    "code":100,"error_subcode":2018234,
    "fbtrace_id":PsvaD93Ges2"
  }
}

Getting the Thread Owner

To get the app ID of the current thread owner, send a GET request to the /thread_owner endpoint.

The thread the API should return the owner of is specified by providing the PSID of the user in the thread in the recipient parameter of the request:

curl -X GET "https://graph.facebook.com/v2.6/me/thread_owner?recipient=<PSID>&access_token=<PAGE_ACCESS_TOKEN>"

For complete API details and request properties, see the Thread Owner API Reference.

On success, the Messenger Platform will return the thread_owner object with the app_id of the app that currently has thread control in the body of the response:

{
  "data": [ 
    {
      "thread_owner":{
        "app_id": <APP_ID>
       }
    }
  ]
}