Created
January 15, 2021 18:07
-
-
Save gregavola/730ae3a93c4e8c48d317eaf7781e4619 to your computer and use it in GitHub Desktop.
A way to dynamic share content via Screensnaps IO: http://screensnaps.io/use-cases/dynamic-share-content
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
const axois = require('axois') | |
// Payload to send, make sure you include any CSS or Font Library at the time | |
const data = { | |
html: "ENTER YOUR MARKUP HERE", | |
} | |
const config = { | |
headers: { | |
Authorization: 'USER_ID_HERE', | |
}, | |
}; | |
return axios | |
.post(`https://api.screensnaps.io/v1/screenshot?api_key=${API_KEY_HERE}`, data, config) | |
.then((response) => { | |
// your image is here | |
console.log(response.data.image_url); | |
}).catch((err) => { | |
alert(err.message); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment