MessengerExtensions.getContext()
이 메서드는 Messenger 확장 기능 SDK의 일부입니다. 사이트에 SDK를 포함하는 데 관한 정보는 Messenger 확장 기능 SDK 추가를 참조하세요.
사용 가능 여부
이 API는 Android의 경우 v113 이상, iOS의 경우 v114 이상의 Messenger 버전에서만 사용할 수 있습니다.
특정 클라이언트에서 사용 가능 여부를 확인하려면 getSupportedFeatures()
를 호출하고 응답의 context
속성을 확인하세요.
The getContext()
method retrieves additional information about the person and the thread that opened the webview within Messenger. It is useful for creating interactive group experiences and games, as well as restricting any content that was intended to be shared only to a certain thread.
MessengerExtensions.getContext(app_id, success, error)
MessengerExtensions.getContext('YOUR_APP_ID',
function success(thread_context){
// success
},
function error(err){
// error
}
);
Parameter | Type | Description |
---|---|---|
| String | Your app ID. |
| Function | Success callback function. Receives the thread context object as an argument. |
| Function | Error callback function. Called if Messenger was unable to retrieve the thread context. |
thread_context
ObjectThe thread_context
object is passed to the success callback.
{
"thread_type": "GROUP",
"tid": "1411911565550430",
"psid": "1293479104029354",
"signed_request": "5f8i9XXH2hEaykXHKFvu-E5Nr6QRqN002JO7yl-w_9o.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTUwNDA0NjM4MCwicGFnZV9pZCI6NjgyNDk4MTcxOTQzMTY1LCJwc2lkIjoiMTI1NDQ1OTE1NDY4MjkxOSIsInRocmVhZF90eXBlIjoiVVNFUl9UT19QQUdFIiwidGlkIjoiMTI1NDQ1OTE1NDY4MjkxOSJ9"
}
Property | Type | Description |
---|---|---|
| String | The ID of the thread the webview was opened from. |
| String | The type of thread the webview was openeed from. The possible types are:
|
| String | The page-scoped user ID for the person that opened the webview. |
| String | A signed request containing the above information. Used to verify the authenticity of the thread context source. For more information, see Validating |