Prerequisites
For this tutorial you need the following:
- A premium Power Automate account, e.g. a Power Automate per user plan or an Powerapps Comunity Plan
- A Social Media Account, e.g. Twitter, Mastodon, LinkedIn, etc.
- The Flows from one of my previous posts Power Automate - How-to Posting on BlueSky and Mastodon
Create AI Prompt in Power Platform
-
Go to Power Automate
-
Click on AI hub in the left navigation
-
Choose AI Prompts
-
Click on Create text using custom prompt
-
Choose Custom task with custom prompts and click on Create custom prompt
-
Enter a name for your AI Prompt
-
Enter your prompt (here is what I used for my prompt)
As an expert in social media, create me witty posts for my social networks (Bluesky and Mastodon) with meaningful hashtags (Microsoft centric) about my newest Blog post that you can find here: [Dynamic Value BlogURL] . Also please take the lowest character count into consideration for the two networks. Also create another post for LinkedIn that can be a bit longer. Please create the posts in a way that will make my followers want to know more about the blog post e.g. with examples or some insides. Please also don’t add any BlogURL. Please just response the post without any explanations. but in the following format: { “ShortPost” : Post text for BlueSky and Mastodon, “LinkedInHeading” : Headline for LinkedIn Post, “LinkedInPost” : Post text for LinkedIn }
Create the Flow in Power Automate
This is the Flow I created for writing post on social media. I will explain the steps in the following sections.
- “Manually trigger a flow” (this is the trigger) Of course you could also use another trigger like schedule post from a calendar .
- “Get Item” from SharePoint Online. This step gets the URL of the newest blog post from my SharePoint Blog list.
- “AIBuilder Predict Custom Prompt” from Common Data Service for Apps. This step uses the AI Prompt we created in the previous section to create the post text for the social media networks.
- “Start and Wait for a Text Suggestion Approval” from Approvals. This step waits for the approval of the post text. I use this step to check the post text before it is posted on social media. If you don’t want to check the post text before it is posted on social media you can skip this step and go directly to the next step.
- “Parse JSON”. This step parses the JSON from the previous step and creates the variables for the post text. Copy the JSON from the AI Builder step and paste it into the “Schema” field.
- “Condition”. This step checks if we approved the AI generated post text or not. If we approved the post text it will go to the next step. If we didn’t approve the post text it will go to the “Condition - No” step which will lead to the end of the Flow.
- “Apply to each”. This step will create a post for each social media network that we put in the Column in the SharPoint list. With the “switch” step we are running the “Run a Child Flow” step to create the post for each needed social media network. As you can see this is a very simple Flow. But it will save you a lot of time and you can be sure that your post text is correct. Now let’s see how you will use this Flow to create your social media posts. Please leave a comment if you have any questions or suggestions. Also please share your use cases for this Flow.