NAV
curl
  • Get All Logs
  • Get All Logs

    Get All Logs

    GET /api/v2/{orgId}/logs

    This endpoint retrieves all logs for the widget specified by the users, or all logs for all widgets the user has access to, if no widget is specified.

    HTTP Request

    This is what an HTTP request looks like. Scroll down more for an actual code example.

    GET https://www.snapengage.com/api/v2/{orgId}/logs

    Parameters

    Parameter Type Description
    orgId String Required. You can find your orgId in the Admin Dashboard, on the My Account -> Api Token page, after you have generated an API token.
    widgetId String A single widget ID, or the list of all widget IDS to return logs for. If not specified, all widgets the user has access to will be returned.
    timezone String The timezone requested. If not specified, "Etc/UTC" will be used as the default.
    start String Required. The ISO8601 date to start returning logs from.
    end String Required. The ISO8601 date to stop returning logs from.
    next String If more than 100 results are returned, a value for linkToNextSetOfResults will be returned that can be used to access the next set of results. Otherwise, this parameter is not specified. Note that this capability only works when specifying a single widgetId, multiple widgetIds are not currently supported!

    Example Logs API Usage

    curl "https://www.snapengage.com/api/v2/{orgId}/logs?widgetId={widgetId}&start=2017-04-20&end=2017-04-28" -H "Authorization: api_token"
    

    In the sample cURL command to the right, replace {orgId} with your orgId. Replace {widgetId} with your widgetId. Replace api_token with your own API token.

    Copy your edited string into your command line interface, then submit the command.

    Sample API response

    Click the JSON tab to the right to view sample response JSON.

    {
        "cases": [
            {
                "id": "a7e91ae8-d4f4-4990-9da6-3b41fe072cc9",
                "url": "https://www.snapengage.com/viewcase?c=a7e91ae8-d4f4-4990-9da6-3b41fe072cc9",
                "type": "chat",
                "requested_by": "[email protected]",
                "requester_details": {
                    "name": "George",
                    "emails": ["[email protected]"],
                    "phones": [],
                    "social_profile_links": [
                        "twitter,bloooppppppp,425240992,https://twitter.com/bloooppppppp"
                    ],
                    "age": 0,
                    "notes": "",
                    "avatars": [],
                    "other_data": []
                },
                "description": "hey",
                "created_at_date": 1493286277463,
                "created_at_seconds": 1493286277,
                "created_at_milliseconds": 463,
                "proactive_chat": false,
                "page_url": "http://localhost:2000/",
                "referrer_url": "",
                "entry_url": "http://localhost:2000/",
                "ip_address": "93.219.34.218",
                "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36",
                "browser": "Chrome (57.0.2987.133)",
                "os": "Apple OS X 10.10.5",
                "country_code": "DE",
                "country": "Germany",
                "region": "BE",
                "city": "Berlin",
                "latitude": 52.520008,
                "longitude": 13.404954,
                "source_id": 2,
                "chat_waittime": 2,
                "chat_duration": 3,
                "chat_responded": true,
                "chat_agent_id": "wc:[email protected]",
                "chat_agent_alias": "Michael Cera!",
                "survey_score": 100,
                "survey_comments": "He was a good guy.",
                "language_code": "en,en-US;q=0.8,pt;q=0.6",
                "transcripts": [
                    {
                        "id": "",
                        "date": 1493286278592,
                        "date_seconds": 1493286278,
                        "date_milliseconds": 592,
                        "alias": "",
                        "message": "hey"
                    },
                    {
                        "id": "wc:[email protected]",
                        "date": 1493286280821,
                        "date_seconds": 1493286280,
                        "date_milliseconds": 821,
                        "alias": "Michael Cera!",
                        "message": "hi"
                    }
                ],
                "javascript_variables": [
                    {
                        "name": "productName",
                        "value": "Der Blahster"
                    },
                    {
                        "name": "productPrice",
                        "value": "$3.99"
                    }
                ],
                "operator_variables": [
                    {
                        "name": "Label",
                        "value": "Labellabellabel"
                    }
                ],
                "labels": [
                    {
                        "name": "Label",
                        "value": "Labellabellabel"
                    }
                ],
                "destination_url": "mailto:[email protected]",
                "visitor_transcript_email": "[email protected]"
            }
        ],
        "linkToNextSetOfResults": ""
    }
    

    Special Notes about Return Data

    Most of the returned data is pretty self-explanatory. However some of the data may need some additional explanation, which is below.

    survey_score and survey_comments You will see a survey score for a chat conversation if a widget has the survey enabled, and if the visitor has chosen to rate the agent at the end of the chat. When a chat ends, we wait 5 minutes before storing the survey data, and the survey actually may stay open on the visitor’s browser for any extended amount of time, which means that the survey score and comments may be stored to the conversation long after the end time of the chat. This is important because if you are querying the Logs API to return survey data for your chat agents, you should wait a minimum of 5 minutes after the close of a chat before expecting to see survey data for that chat.

    visitor_transcript_email You will see this field returned if a widget has the visitor email transcript feature enabled, and if the visitor has chosen to submit an email address to receive an email copy of their chat transcript.