An application that posts check-ins on Swarm to social media(X/Twitter).
At check-in on Swarm, receives a webhook and then posts to X/Twitter.
The posted text will be as follows. Note that attached comments and images will not be included in the post.
I'm at [Venue name] in [Venue address]
[Share URL]
- authorization.php - Initiates authorization to obtain the access token.
- access_token.php - After authentication, redirected from Foursquare to obtain the access token.
- tweet_by_push.php - At check-in on Swarm, receives a webhook and then posts to X/Twitter.
- PHP >= 8.0
- vlucas/phpdotenv
- abraham/twitteroauth
- ext-curl
- ext-openssl
Download and install Composer. Then, run the following command to install the dependencies.
$ composer installCreate a .env file based on the .env.example file and set it up to match your environment.
Important
Ensure that the .env file is protected from external visibility as it contains confidential information.
Set the Foursquare API version. If there is no reason, leave it as the default.
FOURSQUARE_API_VERSION="20240601"Obtain and set the following credentials from Foursquare Developer Console.
FOURSQUARE_API_KEY=""
FOURSQUARE_API_KEY_SECRET=""
FOURSQUARE_PUSH_SECRET=""Set the URL to access the access_token.php file.
FOURSQUARE_REDIRECT_URI="https://example.com/access_token.php"The Foursquare access token will be set later.
FOURSQUARE_ACCESS_TOKEN=""Obtain and set the following credentials from X/Twitter Developer Portal.
TWITTER_API_KEY=""
TWITTER_API_KEY_SECRET=""
TWITTER_ACCESS_TOKEN=""
TWITTER_ACCESS_TOKEN_SECRET=""Access Foursquare Developer Console and configure the following.
Redirect URL- Set the URL to access theaccess_token.phpfile.
Push Notifications- SelectPush checkins by this project's users.Push URL- Set the URL to access thetweet_by_push.phpfile.Push Version- Set the push API version. If there is no reason, set it to20240601.
Access the authorization.php file through your web browser and authenticate with Foursquare.
After authentication, append the access token displayed in the web browser to the .env file.
FOURSQUARE_ACCESS_TOKEN=""Due to the above settings, at check-in on Swarm, the tweet_by_push.php file will be accessed and then posted to X/Twitter.
This software is licensed under the Unlicense.