Skip to content
Floyd Diebel edited this page Oct 20, 2026 · 13 revisions

Email

Stir can integrate with any platform that can be emailed at unique addresses to execute tasks or receive data. The most common use for this integration would be post emails to a task manager to create work logs.

Addresses can look like ####@yourdomain.com or head-####@yourdomain.com with #### being a unique ID for your particular project. Generally this number is a project or task number within your project management platform.

  1. Edit global.conf (normally found in /etc/stir/) and set the correct values for POST_EMAIL_HEAD and POST_EMAIL_TAIL
  2. Edit your project's .stir.sh file and set the values for TASK, TASK_USER, and ADD_TIME (optional)
  3. Test your configuration with stir --test-email [project] at the shell prompt

Note: you can send email by running a local server, or by using an SMTP mail server. Set USE_SMTP=TRUE in /etc/stir/global.conf and make sure you have ssmtp properly configured.

Slack

Slack is an open, collaborative environment for team communication. Stir can post error and success notifications to any user or channel that you wish.

  1. Go to this link and follow the instructions to create webhook endpoints
  2. Edit the Slack section in global.conf and set values for POST_TO_SLACK, SLACK_URL, and SLACK_ERROR as needed; SLACK_URL will be the URL that you created in step 1
  3. Variables can be set in your project's .stir.sh as well, and will override the global settings (for that project)
  4. Run stir --test-slack [project] to test

PHP Server Monitor

PHP Server Monitor checks whether your websites and servers are up and running. It comes with a web based user interface where you can manage your services and websites, and you can manage users for each server with a mobile number and email address.

  1. Create a server in your PHP Server Monitor dashboard, and give access to the user that Stir will spoof
  2. Set values for MONITOR_URL, MONITOR_USER, MONITOR_PASS, and SERVER_ID in your project's .stir.sh
  3. Run stir --test-monitor [project] to check your configuration

Google Analytics

Google Analytics lets you measure advertising ROI as well as track your web sites and applications. Stir can make use this data when creating its statistic pages for your projects.

OAuth authentication and refresh tokens

Stir uses Google OAuth 2.0 to authenticate with the Google Analytics Data API (GA4). Access tokens expire approximately every hour, but Stir automatically refreshes them using a long-lived refresh token.

To avoid having to reauthorize Stir periodically, the Google OAuth application must be configured correctly.

1. Configure Google OAuth

  1. Open the Google Cloud Console and select your project.

  2. Navigate to Google Auth Platform → Audience.

  3. Set the user type to External if you are not using a Google Workspace organization.

  4. Make sure the publishing status is In production. Applications left in Testing issue refresh tokens that expire after seven days, unless only basic identity scopes are requested.

  5. Navigate to Google Auth Platform → Clients and create or select an OAuth 2.0 client with the application type Web application.

  6. Add the following Authorized redirect URI:

    https://developers.google.com/oauthplayground

  7. Save your configuration and make note of the Client ID and Client Secret.

Make sure the Google Analytics Data API is enabled for your Google Cloud project.

Note: Google may indicate that your application requires verification. Verification is not necessarily required for limited personal use, although unverified applications may display warnings and have restrictions.

2. Generate a refresh token

  1. Open the Google OAuth 2.0 Playground.

  2. Click the settings gear in the upper-right corner.

  3. Enable Use your own OAuth credentials and enter the Client ID and Client Secret from your Google Cloud project.

  4. Set Access type to Offline and Prompt to Consent, if these options are available.

  5. In Step 1, enter the following API scope:

    https://www.googleapis.com/auth/analytics.readonly

  6. Click Authorize APIs and sign in with a Google account that has access to your GA4 properties.

  7. Approve the requested permissions.

  8. In Step 2, click Exchange authorization code for tokens.

  9. Copy the generated Refresh token.

Be sure to use your own OAuth credentials rather than the Playground's default credentials.

3. Configure Stir

Add the following variables to your Stir configuration, replacing the example values with your own credentials:

CLIENT_ID="your-client-id"
CLIENT_SECRET="your-client-secret"
REFRESH_TOKEN="your-refresh-token"
PROFILE_ID="your-ga4-property-id"

PROFILE_ID should contain your numeric GA4 property ID, not your Measurement ID (which begins with G-).

The OAuth credentials can be stored globally if shared across projects, while individual projects can define their own PROFILE_ID.

Stir automatically requests new access tokens when needed. There is no need to manually update ACCESS_TOKEN.

Keep OAuth credentials private and out of version control.

4. Test the connection

Run the following command against a configured project:

stir --test-ga4

Stir will refresh the access token, retrieve seven days of GA4 data, and test the reporting functionality.

Troubleshooting expired tokens

If Google returns:

Google OAuth error: invalid_grant
Token has been expired or revoked.

The refresh token may have expired or been revoked.

This can happen when:

  • The OAuth application was in Testing when the token was generated, causing it to expire after seven days
  • The user revoked the application's access
  • The refresh token has not been used for six months
  • Google invalidated the token for another security or account-related reason

To resolve the issue:

  1. Confirm that the OAuth application's publishing status is In production.
  2. Repeat the authorization process in Step 2 to generate a new refresh token.
  3. Replace the existing REFRESH_TOKEN value in Stir's configuration.
  4. Run stir --test-ga4 to verify the connection.

Changing an application from Testing to In production does not restore an already expired refresh token. Generate a new token after changing the publishing status.

Refresh tokens issued to production applications are not subject to the seven-day Testing expiration, but they can still be revoked or expire under certain conditions.

For additional information, see Google's OAuth 2.0 documentation.

Webhooks

If Stir doesn't talk natively to a platform you need, you may be able to use a Webhook.

  1. Configure end points in the platform you want to receive the webhook payload
  2. In your project's .stir.sh set POSTURL to the endpoint url
  3. Test by running stir --test-webhook [project]

Note: Use a site like this one to test your configuration.

Invoice Ninja

Invoice Ninja is the #1 open-source platform to create & email invoices, track payments and expenses, and time billable tasks & projects for clients. Stir can create and send new invoices manually or on a schedule.

  1. Go to https://app.invoiceninja.com/settings/api_tokens (or your self-hosted URL) and create an API key
  2. In global.conf, assign values for IN_HOST, IN_TOKEN, and IN_OFFSET
  3. Edit your project's .stir.sh and assign values for IN_CLIENT_ID, IN_PRODUCT, IN_ITEM_COST, IN_ITEM_QTY, IN_NOTES, and IN_EMAIL as needed

Note: If your first invoice number in your Invoice Ninja was not 1, you will need to make sure and set IN_OFFSET to the first invoice's number. This is to work around the fact that Invoice Ninja's API uses the internal invoice number as opposed to the front-facing number.

Bugsnag

Bugsnag monitors application stability so you can make data-driven decisions on whether you should be building new features, or fixing bugs.

Note: This integration is working but not useful. It is in development, under review, and may not be fully implemented.

  1. Go to https://app.bugsnag.com/settings/YOURORGANIZATION/my-account/auth-tokens and generate a new token, and copy the value
  2. Edit your global.conf and set BUGSNAG_AUTH to the value of the token created above
  3. Run stir --test-bugsnag [project] in the shell to test

Clone this wiki locally