Workflow Example: Get Tweet Info

This workflow is an example of how you can get content and meta data information about a specific Twitter post ("tweet") if you have the URL of the post. This includes details about who made the post and when it was made.

The workflow begins by offering to allow you to select an example Tweet URL, to enter your own (custom) URL or to use a URL on the clipboard (there's no validation on this as this is just an example workflow). The workflow takes the tweet ID from the end of the URL (by splitting the URL on the forward slashes and taking the last item). It then appends this to a pre-set Twitter API URL. The URL is then used by Workflow to retrieve a JSON result set from the Twitter API.

At this point the workflow prompts you to select the meta data item to return (name, user name (handle), user profile URL, the actual content of the tweet and the date on which the tweet was posted.

A number of JSON dictionary keys are then used to read in the appropriate data for the tweet. The name and user profile URLs are simple data item retrievals. The user name however is extrapolated form the user profile URL (it's the last part) and prefixed with an "@".

Retrieving the content of the tweet requires a bit of extra work as some extraneous information is stripped out with a bit of splitting and replacing. This extraneous information is the name, user name and date line appended to the end of the content. The upshot is however that a similar approach can be made to extract the date and this can then be reformatted.

You could easily modify this basic example to fetch multiple items and build other outputs; but always note that this workflow is entirely dependent on the Twitter API. If that API changes or if deprecated it is quite possible this workflow will need to be re-worked in some way.