Quick Start
The Predis.ai SDK 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 SDK.
tip
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 SDK.
- 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.
index.html
<script
type="text/javascript"
src="https://predis.ai/sdk/embed.js"
async
defer
crossorigin="anonymous"
></script>
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);
},
});
});