Hi Guys,
Im trying to create a snippet that automates tweets.
So far I have a snippet as below that takes a documents ID, and sends the tweet.
I need to create a snippet that returns a document ID within a time frame of being published.
It will run with cron manager.
So for all documents under parent 2...
tweet 2 hours after published.
tweet 14 hours after published.
Tweet 30 days after published.
Does anyone know if this is possible? To check a documents publish date and return it a certain time frame after being published.
Any Guidance appreciated.
<?php
$tweetId = isset($tweetId)? $tweetId : '';
$resource = $modx->getObject('modResource',$tweetId);
$tweetContent = $resource->get('pagetitle');
$tweetAlias = $resource->get('alias');
$tweetURL = 'http://domain.com/'.$tweetAlias;
$finalTweet = $tweetContent.' '.$tweetURL;
define('consumerSecret' ,'x');
define('consumerKey' ,'x');
define('oAuthSecret' ,'x');
define('oAuthToken' ,'x');
require_once('oAuth/twitteroauth.php');
// create a new instance
$tweet = new TwitterOAuth(consumerKey, consumerSecret, oAuthToken, oAuthSecret);
//send a tweet
$tweet->post('statuses/update', array('status' => $finalTweet));