Lots of community members use Power Automate to repost tweets or blog posts (using the RSS feed trigger) to social media like LinkedIn or Twitter. But normally those messages have exactly the same structure all the time, simply reposting the content and adding the same additional hashtags or the same custom text/emojis.
Why not add a different touch and add a random emoji to those automated posts or messages?
Check out how to add a random emoji to each automated message or post.
Create the Emojis Array
To begin, create an array variable in your Power Automate flow (named ‘Emojis’).
Inside the array variable, declare the list of your selection of emojis using the following format (Wrap the emojis in double-quotes and separate them using a comma, all inside of square brackets):
The idea of creating a list is that you can have control of the possible list of different emojis.
Tip: To insert emojis into Power Automate actions, use the combination of Windows key + ., which opens the Emoji find tool:
After you have created your emoji array, use the following expression to randomly get an emoji from your emojis list (on the example below I added it to the compose action):
Logic of the expression:
This expression gets a random integer number ranging from zero until the size of the array minus 1 (array indexes start at 0 in Power Automate, but the rand function gets a random value from start value until the end value minus 1), and then gets the emoji at this index in the array.
- The rand function uses as parameters the start and end ranges (0, Array Length)
- We use the length function to check the size of the array
- After we get a random number, then we use it to access the string at the random index in the emojis array variable.
If you follow the example above and add it to a compose action, you can reference the compose action in your post or message. On the sample below we are getting new posts from the Microsoft 365 blog and before Tweeting them, we add the randomly selected emoji:
If you follow the sample above, when a new post is available in a blog, your flow runs, and each time it runs will get a random emoji and add it to your post as below: