Get context data

Retrieve a JavaScript object of all the data you have stored for this chatbot user, including their name, time zone, whether they’re subscribed, and any custom data you have stored.

Endpoint

EndpointHTTP Method
/user/v1/context_dataGET

Parameters

ParameterTypeDescriptionInRequired
accessTokenStringWebview access tokenQueryTrue

Response

CodeDescriptionReturns
200SuccessJavaScript object of stored user data.
400Error 

Example

var shoeSize;
$.ajax({
    type: ‘GET’,
    url: ‘/user/v1/context_data?accessToken=’ + accessToken,
    contentType: ‘application/json’,
    data: JSON.stringify(body),
    success: function(userData, xhr, textStatus){
        if(userData.shoeSize){
            shoeSize = userData.shoeSize;
        }else {
            shoeSize = null;
        }
    },
    complete: function(xhr, textStatus){
        if(xhr.status == 400){
            console.log(“error”);
        }
    }
});
Was this article helpful?
0 out of 0 found this helpful