Skip to content

Instantly share code, notes, and snippets.

@Niweera
Last active February 26, 2022 12:55
Show Gist options
  • Save Niweera/498701d3dbbae298ba574eb2a89af529 to your computer and use it in GitHub Desktop.
Save Niweera/498701d3dbbae298ba574eb2a89af529 to your computer and use it in GitHub Desktop.
TweetPik API service
import axios from "axios";
import config from "../keys";
export default class TweetPikService {
async getScreenshot(tweetId) {
const response = await axios.post(
`https://tweetpik.com/api/images`,
{
tweetId,
themeId: config.TWEETPIK_THEME_ID,
timezone: "Asia/Colombo",
},
{
headers: {
"Content-Type": "application/json",
authorization: config.TWEETPIK_API_KEY,
},
}
);
console.log(`Now obtained the original screenshot`);
return `${response.data.url}?${new Date().getTime()}`;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment