Quick Start
The Predis.ai Button allows you to seamlessly integrate Predis.ai's Content Creation flow with your website or mobile app. This guide explains everything you need to know to get up and running with the Predis.ai Button.
Please reach out to us on [email protected] if you have any queries. This documentation is evolving and can change.
Step 1: Sign up to get an App ID
You need an App ID to use the Predis.ai Button.
- Please login or make a new account at app.predis.ai
- Navigate to My account -> API to generate a new key
Step 2: Setup the Button
Adding the button to a website needs integrating with Predis.ai SDK. Add the following to complete the basic SDK setup.
HTML
Add the javascript SDK in the head
tag of index.html file.
<script
type="text/javascript"
src="https://predis.ai/sdk/embed.js"
async
defer
crossorigin="anonymous"
></script>
Place the following element in the body
tag of index.html file. This element is used to render the Predis.ai app for various operations.
<div id="predis-embed-root"></div>
Launching Predis.ai Content Generator
Predis.ai post creation can be triggered by calling createPost
as shown below.
const predis = new window.Predis();
predis.initialize({ appId: "YOUR_APP_ID" });
predis.on("ready", () => {
// open Predis.ai post creator
predis.createPost({
onPostPublish: function (err, data) {
// published posts' data
console.log(err, data);
},
});
});