This package let you integrate easily with Asana Webhooks.
Install the package via composer:
composer require giagara/laravel-asana-webhookPublish config file with
php artisan vendor:publish --tags=asana-webhookFirst 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_tokenConfigure 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.
php artisan asana:list-webhookNOTE: For this feature create ASANA_WORKSPACE_ID field in .env file.
get workspace id by calling this url
To create a new webhook in Asana you can use the CreateWebhookCommand by calling:
php artisan asana:create-webhookIt 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/webhookphp artisan asana:create-webhook --resource=1234 --route=route-nameThe --route parameter is the route name: see php artisan route:list
php artisan asana:delete-webhook {webhook_gid}- Create webhook list command
- Delete a webhook via command
- Add middleware to route configs
- Add name to route config
- Trigger via route name
composer testPlease see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.