Documentation

Get started with documentation and helpful guides
for using the PestoAI developer API, embed code snippets, and more


IMPORTANT! Before embedding code snippets in your website, make sure you have connected your site in the PesotAI console and are using the correct embed snippets which are available in the site settings under 'connection instructuctions'



USING THE PESTOAI CONSOLE

After you signup to PestoAI, you can log into the console with your email and password. The console allows you to connect your site, retrieve the code snippets to embed in your site, manage settings, and more.

Once you have connected your site and embedded the code snippets, your first post will be generated. You can review, edit, publish, and unpublish posts from the console. You can also add an author profile to posts or set a default author profile on all posts.

Keep in mind that only published posts will be visible to viewers on the page in your website where you embedded the posts list

The PestoAI console also lets you manage site settings such as post frequency and auto-publish, as well as invite team members to collaborate with different permissions. To log in to the console, visit the following link:

Log in to the PestoAI Console





CONNECTING A WORDPRESS, SHOPIFY, OR WIX SITE

If your site is hosted using Wordpress, Shopify, or Wix, you can easily install the PestoAI plugin/app instead of using our embedable snippets. The PestoAI plugin/app generates posts directly to the blog posts section in Wordpress/Shopify/Wix and is a convienient option for those who are already managing their blog posts in these services, or want to control their blog theme

PLEASE NOTE: If you need to edit or publish a post, please do so from the PestoAI console rather than from your Wordpress/Shopify/Wix so the two systems keep in sync

To install the PestoAI plugin/app, make sure you are logged in to your Wordpress/Shopify/Wix account and visit our plugin/app page:





EMBEDDING THE POST FEED IN YOUR WEBSITE

PestoAI provides an embeddable code snippet that you add to your website's HTML for showing a list of published posts. It is best to place the code in the main section of the page in your website dedicated to your blog. Your site's specific embed code can be found in your site settings in the PestoAI console. Your code snippet will look something like this:


    <script src="https://assets.pestoai.com/js/jquery.min.js"></script>
    <script src="https://assets.pestoai.com/js/embed.js"
        data-site-id="YOUR_SITE_ID"
        data-host="blog.yourdomain.com"
        data-post-page-url="http://www.example.com/blog/post"
        data-limit="10">
    </script>
    <div class="pai-content"></div>
                    

IMPORTANT! Make sure the value of data-post-page-url is the url of the page in your website that you embedded the post content code snippet in.
This is the page that viewers will be sent to when they tap on a blog post in the list.





EMBEDDING THE POST CONTENT IN YOUR WEBSITE

PestoAI provides an embeddable code snippet that you add to your website's HTML for showing the content of a post. You should have a page dedicated to this (ie https://www.example.com/blog/post), and you should place the code snippet in the main section of that page. Your site's specific embed code can be found in your site settings in the PestoAI console. Your code snippet will look something like this:


    <script src="https://assets.pestoai.com/js/jquery.min.js"></script>
    <script src="https://assets.pestoai.com/js/embedpost.js"
        data-site-id="YOUR_SITE_ID"
        data-host="blog.yourdomain.com" >
    </script>
    <div class="pai-post-content"></div>
                    

IMPORTANT! The URL of the page you embed your post content snippet in is the URL you must use for the value of the data-post-page-url property in the posts list snippet
See Embedding the Posts Feed in Your Website





USING THE PESTOAI API

The PestoAI API allows interaction with the service, offering two main RESTful API endpoints: one to retrieve a list of published posts, and another to retrieve content for a specific post. API responses are in JSON format.



AUTHORIZATION:

  • HEADER 'x-api-key' : YOUR_API_KEY

    To make authorized API requets, use the API Key for your site as the value for the 'x-api-key' header. The API Key can be found in the PestoAI console site settings for that site. Each site has a different API Key.
  • You can find your API key and site ID by logging into your PestoAI account, and then navigating to the site settings > 'connection instructions'




GETTING THE LIST OF PUBLISHED POSTS:

  • GET https://api.pestoai.com/v1/getpublicpostsforsite

    Retrieves the list of posts that have been generated and published for a site.
  • Only published posts will be returned by the API. You can publish a post from the PestoAI console or you can turn on auto-publish to have newly generated posts published automatically


Example request properties:


        "site_id": "YOUR_SITE_ID",  //You can find your site id in the site settings in the PestoAI console
        "response_format": "json",
        "limit": 10,  //The anmount of posts you want to be returned in one page
        "start_key": "LAST_KEY" || null,  //This is used to get the next page of posts
                    

Example response:


    {
        "posts": [
            {
                "site_id": "SITE_ID",
                "post_id": "POST_ID",
                "title": "POST_TITLE",
                "lookup_id": "LOOKUP_ID",
                "published_time": "JAVASCRIPT_DATE",
                "image_url": "POST_IMAGE_URL" //An AI generated image that relates to the post. null if it does not exist
            }
        ],
        "lastKey": "LAST_KEY", //This is used to get the next page of posts by supplied it as the start_key in the next request
        "response_format": "json"
    }
                    



GETTING THE CONTENT OF A POSTS:


  • GET https://api.pestoai.com/v1/getpostcontent

    Retrieves content for a specific post. Expects request body with site_id, post_id, and response_format (json only).

Example request properties:


        "site_id": "SITE_ID",  //This will be on each post that was retrieved via the getpublicpostsforsite API
        "post_id": "POST_ID",  //This will be on each post that was retrieved via the getpublicpostsforsite API
        "response_format": "json"
                    

Example response:


    {
        "site_id": "SITE_ID",
        "post_id": "POST_ID",
        "title": "POST_TITLE",
        "lookup_id": "LOOKUP_ID",
        "published_time": "JAVASCRIPT_DATE",
        "image_url": "POST_IMAGE_URL", //An AI generated image that relates to the post. null if it does not exist
        "content": "POST_CONTENT",
        "author" = {
            "id": "PROFILE_ID",
            "name": "FULL_NAME",
            "image_url": "PROFILE_IMAGE_URL", //null if it does not exist
            "social_url": "PROFILE_SOCIAL_URL", //null if it does not exist
            "bio": "PROFILE_SOCIAL_URL", //null if it does not exist
        },
        "response_format": "json"
    }
                    




PESTOAI iOS AND ANDROID APPS

PestoAI has convenient iOS and Android apps that allow you to easily manage your sites and posts on the go. The apps have all the important funcitonlity that the web console has including the ability to edit posts. To use the apps on your iPhone or Android device simply download them from the Apple App Store or Google Play Store.

PLEASE NOTE: The iOS app does not currently have billing management. If you need to manage billing, please do so from the PestoAI web console