giagara/laravel-asana-webhook
最新稳定版本:1.0.4
Composer 安装命令:
composer require giagara/laravel-asana-webhook
包简介
Laravel asana webhook integration
README 文档
README
This package let you integrate easily with Asana Webhooks.
Installation
Install the package via composer:
composer require giagara/laravel-asana-webhook
Publish config file with
php artisan vendor:publish --tags=asana-webhook
Usage
First of all you need to configure the personal access token to communicate with Asana. You can get it here: https://developers.asana.com/docs/personal-access-token
Add it in your .env file
ASANA_PERSONAL_ACCESS_TOKEN=your_token
Configure the routing by adding items to the route array in config file.
'routes' => [ 'webhook' => AnInvokableClass::class ],
Alternatively the configuration can support name and middlewares
'routes' => [ 'webhook' => [ 'class' => AnInvokableClass::class, 'name' => 'webhook-1', 'middleware' => [CustomMiddleware::class], ] ]
NOTE: the invokable class must implements AsanaActionInterface.
NOTE: the route is forced to use api/ prefix so, in this case, the final path will be api/webhook.
Example:
use Giagara\AsanaWebhook\Contracts\AsanaActionInterface; class FakeInvokableClass implements AsanaActionInterface { public function __invoke(array $payload) : void { // do something } }
After this the route api/webhook will be mapped to your invokable class.
Available commands
Webhook list
php artisan asana:list-webhook
NOTE: For this feature create ASANA_WORKSPACE_ID field in .env file.
get workspace id by calling this url
Webhook creation
To create a new webhook in Asana you can use the CreateWebhookCommand by calling:
php artisan asana:create-webhook
It will ask for resource id (see Asana documentation) and target url (that should be already reachable by Asana).
You can pass the parameters in command directly with:
php artisan asana:create-webhook --resource=1234 --target=https://example.com/api/webhook
php artisan asana:create-webhook --resource=1234 --route=route-name
The --route parameter is the route name: see php artisan route:list
Delete Webhook
php artisan asana:delete-webhook {webhook_gid}
TODO
- Create webhook list command
- Delete a webhook via command
- Add middleware to route configs
- Add name to route config
- Trigger via route name
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email giagara@yahoo.it instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-29