Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PubNub Mapping w/ Mapbox BLOCK
export default request => {
let xhr = require('xhr');
let query = require('codec/query_string');
let clientToken = 'YOUR_CLIENT_TOKEN';
let apiUrl = 'https://api.mapbox.com/styles/v1/mapbox/streets-v8/static';
let zoom = request.message.zoom;
let resolution = '300x200';
let lat = request.message.lat;
let lng = request.message.lng;
let queryParams = {
access_token: clientToken,
};
apiUrl += '/' + lng + ',' + lat + ',' + zoom + '/' + resolution;
let url = apiUrl + '?' + query.stringify(queryParams);
request.message.map = url;
return request.ok()
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment