Awesome
Ballerina Asana connector
Overview
Asana is a popular project management and team collaboration tool that enables teams to organize, track, and manage their work and projects. It offers features such as task assignments, project milestones, team dashboards, and more, facilitating efficient workflow management.
This Ballerina connector is designed to interface with Asana's REST API, enabling programmatic access to Asana's services. It allows developers to automate tasks, manage projects, tasks, teams, and more, directly from Ballerina applications.
Setup guide
To use the Asana Connector in Ballerina, you must have an Asana account and a Personal Access Token (PAT) or OAuth2 credentials for authentication.
If you already have an Asana account, you can integrate the connector with your existing account. If not, you can create a new Asana account by visiting Asana's Sign Up page and following the registration process. Once you have an Asana account, you can proceed to create a PAT or set up OAuth2.
Step 1: Access Asana developer console
-
Log in to your Asana account.
-
After logging in, navigate to the Asana developer console.
-
Click on the + Create new token button.
<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-asana/master/docs/setup/resources/1-developer-console.png alt="Asana Developer Console" style="width: 80%;">
Step 2: Create a new access token
-
Provide a name for the token and accept Asana's API terms checkbox after reading them.
-
Click on the Create token button.
<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-asana/master/docs/setup/resources/2-create-token.png alt="Generate new PAT" style="width: 80%;">
-
Copy the generated token and keep it secure. You will need this token to authenticate the Asana connector.
<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-asana/master/docs/setup/resources/3-copy-token.png alt="Copy PAT" style="width: 80%;">
Quickstart
To use the Asana
connector in your Ballerina application, modify the .bal
file as follows:
Step 1: Import the module
Import the ballerinax/asana
package into your Ballerina project.
import ballerinax/asana;
Step 2: Instantiate a new connector
Create an asana:ConnectionConfig
with the obtained PAT (or OAuth2) credentials and initialize the connector with it.
asana:ConnectionConfig asanaConfig = {
auth: {
token: authToken
}
};
asana:Client asana = check new (asanaConfig);
Step 3: Invoke the connector operation
Now, utilize the available connector operations.
Get all projects for the authenticated user
record {asana:ProjectCompact[] data?;} projects = check asana->/projects();
Create a new task in a project
asana:Tasks_body taskReq = {
data: {
name: "Email Marketing Campaign",
notes: "Create a new email marketing campaign for the upcoming product launch.",
workspace: "<workspaceId>",
projects: ["<projectId>"]
}
};
record {asana:TaskResponse data?;} taskCreated = check asana->/tasks.post(taskReq);
Examples
The Asana
connector offers practical examples illustrating its use in various scenarios.
Explore these examples, covering the following use cases:
- Employee onboarding process automation - Automate the onboarding process of new employees using Asana projects and tasks.
- Team workload balancer - Evaluate and balance the workload of a given team using Asana tasks and assignments.
Issues and projects
The Issues and Projects tabs are disabled for this repository as this is part of the Ballerina library. To report bugs, request new features, start new discussions, view project boards, etc., visit the Ballerina library parent repository.
This repository only contains the source code for the package.
Build from the source
Prerequisites
-
Download and install Java SE Development Kit (JDK) version 17. You can download it from either of the following sources:
Note: After installation, remember to set the
JAVA_HOME
environment variable to the directory where JDK was installed. -
Generate a Github access token with read package permissions, then set the following
env
variables:export packageUser=<Your GitHub Username> export packagePAT=<GitHub Personal Access Token>
-
Download and install Docker.
Note: Ensure that the Docker daemon is running before executing any tests.
Build options
Execute the commands below to build from the source.
-
To build the package:
./gradlew clean build
-
To run the tests:
./gradlew clean test
-
To build the without the tests:
./gradlew clean build -x test
-
To run tests against different environment:
./gradlew clean test -Pgroups=<Comma separated groups/test cases>
-
To debug package with a remote debugger:
./gradlew clean build -Pdebug=<port>
-
To debug with the Ballerina language:
./gradlew clean build -PbalJavaDebug=<port>
-
Publish the generated artifacts to the local Ballerina Central repository:
./gradlew clean build -PpublishToLocalCentral=true
-
Publish the generated artifacts to the Ballerina Central repository:
./gradlew clean build -PpublishToCentral=true
Contribute to Ballerina
As an open-source project, Ballerina welcomes contributions from the community.
For more information, go to the contribution guidelines.
Code of conduct
All the contributors are encouraged to read the Ballerina Code of Conduct.
Useful links
- For more information go to the
asana
package. - For example demonstrations of the usage, go to Ballerina By Examples.
- Chat live with us via our Discord server.
- Post all technical questions on Stack Overflow with the #ballerina tag.