Created
July 18, 2023 14:47
-
-
Save danmindru/a02fe040341a75e5c6d9b964b582227e to your computer and use it in GitHub Desktop.
IFTTT Filter Code for Crontap & Posting tweets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Parse the Webhook payload. | |
// NB: Crontap adds API response data under the `data` key. | |
let payload = JSON.parse(MakerWebhooks.jsonEvent.JsonPayload); | |
const post = payload.data.posts[0]; // Get the first post. The API returns top 10 posts in this case, and we want to only tweet about the top post. | |
const link = `https://hunted.space/dashboard/${post.slug}`; | |
const upvotes = post.votesCount; | |
const name = post.name; | |
const tagline = post.tagline; | |
let tweet = `Have you seen the top product today? 👀 | |
🔥 ${name} (${upvotes} 🔼) | |
${tagline} | |
Check the link below for more stats! | |
${link}`; | |
Twitter.postNewTweet.setTweet(tweet); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment