Skip to main content

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

NameDescriptionTypeRequired
onPostPublishFunction to receive data when a post is published from the editor. See onPostPublish for more details.Functionno
hide_post_typesArray 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).ArrayNo
modeIf 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.DETAILEDStringNo
customAssetsAn 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.ArrayNo
brandDetails.nameName associated with the brand. This will show up on the UI In places where brand name is shown.StringNo
brandDetails.logo_urlLogo 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.StringNo
brandDetails.brand_hashtagsThese hashtags will be appended to the AI generated caption. You can use it to add any text if needed.StringNo
brandDetails.brand_websiteThe Brand website will be shown on AI-generated creatives. This is shown only if the design has space for website text.StringNo
brandDetails.brand_handleThe Brand handle will be shown on AI-generated creatives. This is shown only if the design has space for the handle name text.StringNo
brandDetails.brand_colorsThe AI-generated creatives will be generated using these colors. Maximum 5 colors can be passed hereArrayNo