Plugin
The Twitter extension comes with a pre-configured plugin
interact with Twitter's v1.1 API "GET" endpoints.
Configuring
Before you can leverage this plugin you need to head to Settings > Extensions > Twitter Extension
and enter your API credentials from https://developer.twitter.com/en/apps.
Getting Started
You can start an API request and configure it by using the twitter
function and chaining options. The twitter
endpoint requires the desired endpoint as the one and only argument. Let's take a look at a similar example as demonstrated on the connection page:
{% set recent = twitter('statuses/user_timeline')
.screenName('pyrocms')
.excludeReplies(true)
.includeRts(false)
.cache(30)
.count(10)
.get()
%}
{% for tweet in recent %}
<p>{{ tweet.text }}</p>
{% endfor %}
For a closer look at what's inside the above return data use dd
on the results:
{{ dd(recent) }}