Microsoft Flow - auto post in twitter and pinterest
The task at hand - a form, when filled, creates a post at [all] social networks, this blog is about twitter and pinterest.
Part 1 - prepare the image
Twitter needs "file content" in its media field, while pinterest needs an image url open to the public.
So [1st flow] was in OneDrive folder for those uploaded images, sending back the image ID to be used in the form. Can take a few minutes, sent to mail (better to send with the image).
The twitter account will create the public url for the image.
Part 2 - the form
Most simple form, Title, Content and image id into [2nd flow] a Sharepoint list. If you're sure you're never going to use more than 255 characters you can just use the title (i dont like to extend title fields characters limit).
Part 3 - to the social media
Next [3rd flow] when the SPItem is created, I use OneDrive "Get file content" for the file content and the "Title - Content" for the text, and post a new tweet.
I then query tweets as "from:@bresleveloper" (or whatever username) in order to get my tweet data, with limit of 1.
Since twitter data takes a minute I also used "Delay Until" with "addSeconds(utcNow(), 90).
NOTICE that if you post tweets separately that this flow you must wait for at least 2 minute before and after the process.
Since twitter data takes a minute I also used "Delay Until" with "addSeconds(utcNow(), 90).
NOTICE that if you post tweets separately that this flow you must wait for at least 2 minute before and after the process.
Unlike other twitter OOTB flows, this one returns an array of tweets and not a single one (even though the query count is 1) so i used "Initialize Variable" of type "Array" for the response, and to query the image url:
first(first(variables('NewTweetsArray'))?['MediaUrls'])
That "Compose" is used as the "Image Url" in pinterest, text same as above.
Enjoy.
I must say machine learning has come a long way and it is striving to evolve in near future. Feel free to swing by https://applesupportnumber.net/blog/fix-iphone-error-4013/
ReplyDelete