Skip to content

Commit

Permalink
Updated so that it concatenates the Updated timestamp for a unique id
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeDouglas committed Jan 22, 2019
1 parent 062c24e commit c7c2c3d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
type: 'password',
required: true,
label: 'API Key',
helpText: "Both your Knack Application ID and API Key are available in your builder’s settings which can be found by clicking the name of your app in the upper-left corner, then Settings, then API & Code."
helpText: "You can find your Hubspot API Key by navigating to Settings > Integrations > API key."
}
],
test: test
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "regency_private_app",
"version": "1.0.0",
"version": "1.0.1",
"description": "A private app for regency using hubspot blogs",
"repository": "zapier/zapier-platform-example-app-trigger",
"homepage": "https://zapier.com/",
Expand Down
14 changes: 9 additions & 5 deletions triggers/blog_post.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ let _ = require('underscore');

const listRecipes = (z, bundle) => {

var date = (Date.now() - 10800000);
var date = (Date.now() - 28800000);

const requestOptions = {
url: 'https://api.hubapi.com/content/api/v2/blog-posts',
params: {
limit: 500,
updated__gt: date
updated__gte: date,
order_by: '-updated'
}
};

Expand All @@ -20,15 +21,18 @@ const listRecipes = (z, bundle) => {


var parsed = JSON.parse(response.content).objects;

parsed.forEach(function(blog_post) {
blog_post.originalId = blog_post.id;
blog_post.id = blog_post.id + '-' + blog_post.updated;
});
if(parsed.length === 0){
return []
}

//sort by updated id
var sorted = _.sortBy(parsed, 'updated').reverse();
// var sorted = _.sortBy(parsed, 'updated').reverse();

return sorted;
return parsed;
});
};

Expand Down

0 comments on commit c7c2c3d

Please sign in to comment.