Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/writecrow/basecamp_api
Drupal integration module for the Basecamp API version 3.0
https://github.com/writecrow/basecamp_api
basecamp3 drupal
Last synced: about 1 month ago
JSON representation
Drupal integration module for the Basecamp API version 3.0
- Host: GitHub
- URL: https://github.com/writecrow/basecamp_api
- Owner: writecrow
- License: gpl-2.0
- Created: 2020-10-04T02:39:58.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-09T01:19:07.000Z (over 1 year ago)
- Last Synced: 2024-04-14T11:53:53.574Z (8 months ago)
- Topics: basecamp3, drupal
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Basecamp API v3 Integration
This is a Drupal module that facilitates using the [https://github.com/basecamp/bc3-api](Basecamp API v3).As an integration module, this facilitates transactions between the Basecamp endpoints, and requires simple coding to achieve this.
After creating an authorized application & storing the initial access token & refresh token, this module will continue to renew the token
via a cron job that runs once per day.Once complete, actions, such as creating a new todo, are as simple as:
```php
$data = [
'content' => $title,
'description' => $message,
'due_on' => date('Y-m-d', strtotime('+7 days')),
'notify' => TRUE,
'assignee_ids' => [1,2,3],
];
$project = $config->get('project');
$list = $config->get('list');
Basecamp::createTodo($project, $list, $data);
```## Proper setup & configuration of the refresh token
At this time, creating the initial access & refresh token is the purview of the developer (and it is pretty easy -- see https://github.com/basecamp/api/blob/master/sections/authentication.md).1. Sign in to Basecamp with the user ID that will provide the integration (in most cases, this should be identified as a non-human account so that people know that actions performed are being triggered by the Drupal integration).
2. Go to https://launchpad.37signals.com/integrations and use the Authorization dialog to generate a 1-time code.
3. Trade this code for a [long-lived access token & refresh token](https://github.com/basecamp/api/blob/master/sections/authentication.md#oauth-2-from-scratch):```bash
curl -X POST -d "type=web_server&client_id=your-client-id&redirect_uri=your-redirect-uri&client_secret=your-client-secret&code=verification-code" https://launchpad.37signals.com/authorization/token
```4. Set these tokens in Drupal's non-config-exportable State API:
```
vendor/bin/drush state:set basecamp_api_refresh_token
vendor/bin/drush state:set basecamp_api_access_token
```5. **Important**: by default, this token will not refresh via cron so that development environments don't accidentally invalidate your access token in the production environment. For the token to be refreshed regularly in your production environment, add the following to your `settings.php` or equivalent:
```
$settings['basecamp_api_do_refresh'] = TRUE;
```