createPost
To open the Predis.ai post creation and editing flow.
Usage
predis.createPost({
onPostPublish: function (err, data) {
console.log(err, data);
},
hide_post_types: ["meme"], // to hide any specific post types
mode: window.Predis.modes.SIMPLE, //to define if you want the detailed mode or minimal mode
customAssets: [{ url: "some_image_url" }], // optional, to pass images inside the Predis.ai post generator
brandDetails: {
name: "Your Brand Name",
logo_url: "https://predis.ai/assets/img/predis_logo-min.webp",
brand_hashtags: "#preidsai",
brand_website: "somewebsite.ai",
brand_handle: "@predisai",
brand_colors: ["#296bd6", "#ff71ab"]
}
}
);
tip
Call the createPost method inside the on("ready") callback which ensures that the SDK is ready.
Parameters
| Name | Description | Type | Required |
|---|---|---|---|
onPostPublish | Function to receive data when a post is published from the editor. See onPostPublish for more details. | Function | no |
hide_post_types | Array of post types to hide from the create post flow. Supported values: "image", "video", "carousel", "faceless_video", "product_photo_shoot", "ugc", "meme", "quote", "special_day", "manual". Multiple values can be passed to hide more than one option. Default: None (all types shown). | Array | No |
mode | If you pass window.Predis.modes.SIMPLE, the popup only show the create flow and library view. Passing window.Predis.modes.DETAILED will also show brand details etc. This is defaulted to window.Predis.modes.DETAILED | String | No |
customAssets | An array of objects with image URLs. If passed in the config, these images show up in the post generation flow and can be used to generate a post. | Array | No |
brandDetails.name | Name associated with the brand. This will show up on the UI In places where brand name is shown. | String | No |
brandDetails.logo_url | Logo associated with the brand. This will show up on the UI In places where brand name is shown. And also used as the brand logo for post generation. | String | No |
brandDetails.brand_hashtags | These hashtags will be appended to the AI generated caption. You can use it to add any text if needed. | String | No |
brandDetails.brand_website | The Brand website will be shown on AI-generated creatives. This is shown only if the design has space for website text. | String | No |
brandDetails.brand_handle | The Brand handle will be shown on AI-generated creatives. This is shown only if the design has space for the handle name text. | String | No |
brandDetails.brand_colors | The AI-generated creatives will be generated using these colors. Maximum 5 colors can be passed here | Array | No |