This shortcode is no longer actively supported. If you need to make HTTP requests, take a look at the HTTP Requests page.

Shortcode: ^httpGetJSONValue()

Makes an HTTP GET request to the supplied URL and inserts a specified value from the response into the bot's message. The HTTP response must be JSON.

^httpGetJSONValue(url, valuePath[, errorMessage])

Parameter Sample Value Description
url "https://my.api.com" Required. The URL to make a GET request
valuePath "results.0.name" Required. Dot-notation specifying the path in the JSON response to retrieve the resultant value from. Dot-notation mirrors that of the Lodash _.get operation.
errorMessage "Could not fetch result" Optional. If the request times out, receives a non-200, or otherwise fails, show this message to the user.

Example Usage

+ find me [*] nearby
- Here's the top result for <star> from Foursquare: ^httpGetJSONValue("https://api.foursquare.com/v2/venues/explore?client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&v=20160101&query=<star>", "response.venues.0.name", "Could not fetch result")

Details