text
stringlengths
0
59.1k
"owner": "owner-name",
"private": false,
"htmlUrl": "https://github.com/owner/repo-name"
},
"payload": {
// Complete GitHub webhook payload
// GitHub webhook payload here
}
}
```
For complete examples of push, pull request, and issue events, see the GitHub webhook documentation.
<|endoftext|>
# source: VoltAgent__voltagent/website/actions-triggers-docs/triggers/gmail.md type: docs
---
title: Gmail Trigger
---
The Gmail trigger monitors your Gmail inbox for new emails using polling. When new messages arrive that match your criteria, VoltOps executes your configured agents or workflows. The trigger checks for new emails every 60 seconds.
For trigger setup and usage instructions, see the [Usage Guide](https://voltagent.dev/automations-docs/triggers/overviewusage/).
**Use Cases**:
- Automate customer support workflows from support emails
- Route and categorize incoming messages
- Extract and process data from email attachments
- Monitor specific email labels for urgent notifications
- Trigger follow-up actions based on email content
## Setting Credential
To set up Gmail authentication, you need to create a credential. This is configured in **Step 1 (Connection)** when creating a trigger.
1. Navigate to the [VoltOps Triggers page](https://console.voltagent.dev/triggers)
2. Select Gmail as the provider
3. In the **Connection** step, either select an existing credential or create a new one
4. Choose between OAuth 2.0 or Service Account and follow the instructions below.
<video controls loop muted playsInline style={{width: '100%', height: 'auto'}}>
<source src="https://cdn.voltagent.dev/console/trigger/gmail/gmail-credentials.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
<br/>
<br/>
### OAuth 2.0
OAuth 2.0 provides token rotation and revocable permissions.
**Setup steps:**
1. Log in to your Google Cloud account and go to [Google Cloud Console → APIs & Services](https://console.cloud.google.com/apis/credentials), then choose or create a project
2. If needed, configure the OAuth consent screen
3. In **Credentials**, select **+ CREATE CREDENTIALS → OAuth client ID**, set type to **Web application**
4. Under **Authorized redirect URIs**, select **+ ADD URI** and paste the VoltOps OAuth redirect URL shown in the console, then select **Create**
5. In **Enabled APIs & Services**, select **+ ENABLE APIS AND SERVICES** and enable the **Gmail API**
6. Back in **Credentials**, open your OAuth client and copy the **Client ID** and **Client Secret**
7. Enter the **Client ID** and **Client Secret** in VoltOps Console
8. Click **Authorize with Google** and grant the requested permissions in the Google authorization window
The authorization status will show "Pending - waiting for confirmation in Google" until you complete the OAuth flow.
**Required OAuth Scopes:**
VoltOps requests the following scopes during authorization:
- `https://www.googleapis.com/auth/gmail.modify`
- `https://www.googleapis.com/auth/gmail.labels`
- `https://www.googleapis.com/auth/gmail.readonly`
**Additional OAuth Parameters:**
- `access_type=offline` - Enables refresh token for long-term access
- `prompt=consent` - Forces consent screen to ensure refresh token is granted
- `include_granted_scopes=true` - Enables incremental authorization
### Service Account
Service accounts provide server-to-server authentication without user interaction.
**Setup steps:**
1. Follow [Google's guide to create a service account](https://cloud.google.com/iam/docs/service-accounts-create) and download the JSON key file
2. Enable the [Gmail API](https://console.cloud.google.com/apis/library/gmail.googleapis.com) for your project
**Configure in VoltOps Console:**
Enter the values from your downloaded JSON key file:
- **Client Email**: The service account email address
- **Private Key**: The full private key (starts with `-----BEGIN PRIVATE KEY-----`)
- **Project ID**: Your Google Cloud project ID
- **Subject** (optional): Email address to impersonate for domain-wide delegation
## Trigger Configuration