# Google Sheets + Slack

Call opted-in leads from Google Sheets and share a concise call receipt in Slack.

This is an example to build and test for the user's accounts, not a preconfigured connector.

## Example

A teammate adds a callback request to a Google Sheet with a unique request ID, a phone number and recorded permission. A scheduled Agent Worker calls the lead and shares the final call status in the team's chosen Slack channel.

## How it works

1. **Find an eligible request.** Poll the selected sheet on an approved schedule. Require a unique, permanent request ID, a valid phone number, recorded permission to call and an eligible status. Skip missing or duplicate IDs and process the outstanding backlog on later polls; a run can start at most five calls. Adapt the Google Sheets lead recipe to check permission: its basic row example does not do that for you.
2. **Call and track the row.** Use a stable call key derived from the request ID, keep the call body the same on retry, and include the request ID in call metadata. Record the call ID against the matching row. Find the row again by its unique ID before writing with RAW input; do not sort, insert or delete rows while the lookup and write are in flight because they are separate operations. Reconcile an uncertain write before retrying.
3. **Share the result.** Enable on_call_ended and read the request ID from call_metadata. Update the matching row and post a minimal call ID and status with Slack chat.postMessage. Track the sheet update and Slack post separately so a partial failure can be reconciled. Check Slack's ok field and save its channel and timestamp. Keep pending messages in your durable outbox; on a rate limit, have a separate scheduler retry after Retry-After. A call-ended run has a 30-second limit and is not automatically rerun after failure. Inspect the channel before retrying an uncertain post. Do not share phone numbers or transcripts unless approved.

## What you need

- Google authorization to read and update the chosen spreadsheet, with short-lived access token refresh handled by your integration. Choose the least access that works: drive.file can limit an app to selected files, while the spreadsheets scope can cover all of the user's spreadsheets.
- A Slack app with chat:write and access to the chosen channel. Store its bot token in the Worker's Vault and allow sheets.googleapis.com and slack.com.
- An enabled Agent Worker, a durable record of request and delivery state, approved limits and a funded wallet. A five-minute schedule can start 288 paid runs per day even when the sheet is empty: at $0.01 per run, that is $2.88 before execution-time charges, call charges and completion runs. Verify current pricing before activation.
- A valid phone number and explicit permission for each call. Test with fictional rows; fixture tests simulate calls and disable external network access.

Agent Worker runs are billed separately from calls and texts. Check instance availability, [pricing](/docs#pricing), permissions and the user's approved limits. Test with fictional data before activation. Preserve stable event IDs and reconcile an uncertain write before retrying it.

## Prompt

```text
Help me connect Google Sheets and Slack for consented lead callbacks. Poll my selected sheet for unique approved requests, use a stable call key, record the call ID safely and send a minimal receipt to my chosen Slack channel. Show how to handle duplicate IDs, row movement, partial failures, uncertain writes, token refresh, limits and costs; test fictional rows before activation.
```

## Provider documentation

- [Thoughtly: Google Sheets scheduled callback recipe](https://agents.thoughtly.com/recipes/google-sheets/call-form-submission)
- [Google Sheets: read values](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/get)
- [Google Sheets: update values](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update)
- [Google Sheets API scopes](https://developers.google.com/workspace/sheets/api/scopes)
- [Slack chat.postMessage](https://docs.slack.dev/reference/methods/chat.postMessage/)
- [Slack rate limits](https://docs.slack.dev/apis/web-api/rate-limits/)

[Agent Worker webhook playbook](/recipes/crm-trigger-call.md) · [Connection guide](/docs#worker-connections)
