> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Dropbox Notify

> LoT connector for the Dropbox notify host: longpoll a folder cursor so the broker learns when files change, without sending an access token

Technical Preview

## Overview

Client-mode REST API connectors for Dropbox: upload shift reports, batch records and alarm snapshots from MQTT as files, download recipes and configs, watch folders for new files with a cursor and longpoll, search, copy, move to archive, restore revisions, save URLs, tag files, and share them with temporary links, shared links and file requests.

This is one of the templates in the Dropbox REST API app (`dropbox`). Deploy it alongside the other connectors of that app when they depend on each other (for example a token connector plus an API connector). See [Dropbox](https://docs.coreflux.org/latest/connectors/rest-api-apps/dropbox.md) for the package overview.

## Auth

* **schemes**: \["Authorization: Bearer \{value.json.access\_token} on every DropboxRestApi and DropboxContentRestApi event except OAuthTokenRefresh (OAuth 2.0 access token of a scoped Dropbox app; short-lived, expires\_in 14400 s)", "OAuthTokenRefresh: POST [https://api.dropboxapi.com/oauth2/token](https://api.dropboxapi.com/oauth2/token), application/x-www-form-urlencoded \{value.json.form} = grant\_type=refresh\_token\&refresh\_token=...\&client\_id=\<app key>\&client\_secret=\<app secret>, no Authorization header", "FolderLongpoll (notify host): no Authorization header (Dropbox answers 400 'Your request includes an Authorization header, but this function does not use it.')"]
* **secrets**: \["DROPBOX\_ACCESS\_TOKEN", "DROPBOX\_REFRESH\_TOKEN", "DROPBOX\_APP\_KEY", "DROPBOX\_APP\_SECRET"]
* **scopes**: \["account\_info.read", "file\_requests.read", "file\_requests.write", "files.content.read", "files.content.write", "files.metadata.read", "files.metadata.write", "sharing.read", "sharing.write"]
* **note**: Inject secrets with a LoT action (GET SECRET); never retain topics that carry the token, refresh token or app secret; restrict storage/dropbox/oauth/# with ACLs (the refresh response carries the new access token). Authorise once with token\_access\_type=offline to get a refresh token. App folder apps see only /Apps/\<app>/.

## Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the Dropbox Notify connector | no |
| `BaseUrl` | string | Dropbox Notify base URL without trailing slash (e.g. [https://notify.dropboxapi.com](https://notify.dropboxapi.com)) | yes |

`BASE_ADDRESS` default: `https://notify.dropboxapi.com`.

## Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `FolderLongpoll` | POST | `/2/files/list_folder/longpoll` | `storage/dropbox/folders/longpoll` | `storage/dropbox/folders/longpoll/response` | `body` |

## Deploy

Get the template card (JSON with `template` and `metadata`) from the broker, then deploy the connector:

```bash theme={"theme":{"light":"css-variables","dark":"css-variables"},"languages":{"custom":["/languages/lot.json"]}}
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-connectorCode DROPBOX_NOTIFY"
```

The deployable connector from the REST API app, with `BASE_ADDRESS` already filled in:

```lot theme={"theme":{"light":"css-variables","dark":"css-variables"},"languages":{"custom":["/languages/lot.json"]}}
DEFINE CONNECTOR DropboxNotifyRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://notify.dropboxapi.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '600'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT FolderLongpoll
        WITH SOURCE_TOPIC "storage/dropbox/folders/longpoll"
        WITH DESTINATION_TOPIC "storage/dropbox/folders/longpoll/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/2/files/list_folder/longpoll"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker REST_API route (https://www.coreflux.org)"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
```

Deploy it with `-addConnector` (do not include `ADD METADATA`).

## Usage example

Call `FolderLongpoll` by publishing a JSON payload to its request topic, and read the reply on the response topic:

```bash theme={"theme":{"light":"css-variables","dark":"css-variables"},"languages":{"custom":["/languages/lot.json"]}}
mosquitto_sub -t 'storage/dropbox/folders/longpoll/response' &
mosquitto_pub -t 'storage/dropbox/folders/longpoll' -m '{"body": {}}'
```

## Related

* [REST API Connectors](https://docs.coreflux.org/latest/connectors/rest-api/overview)
* [REST API Apps catalog](https://docs.coreflux.org/latest/connectors/rest-api-apps)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.