Set Up Azure Cognitive Services
- Go to the Azure Portal and sign in to your account. If you don't have an account, you will need to create one.
- In the Azure Portal, select "Create a resource" and search for "Cognitive Services" to set up the service.
- Choose the specific Cognitive Service you want to integrate with Trello, such as Text Analytics or Computer Vision, and click "Create."
- Configure the necessary settings such as subscription, resource group, and region. Additionally, set the pricing tier according to your requirements.
- Once configured, review and create the resource. After creation, navigate to the resource page to obtain the API key and endpoint URL needed for integration.
Prepare Trello with Butler Automation
- Log into your Trello account and navigate to the board where you want to implement Cognitive Services integration.
- Enable the Butler feature in Trello from the top board menu if it is not already enabled. Butler is Trello’s automation tool that allows you to create rule-based workflows.
- Identify the triggers and actions you want to automate with Azure Cognitive Services. Consider scenarios such as analyzing text data from Trello cards or processing images attached to cards.
Develop Integration with Azure Function App
- Return to the Azure Portal and create a new Function App. Search "Function App" in the marketplace and select "Create."
- Fill in the necessary configurations for your Function App such as Subscription, Resource Group (use the same as Cognitive Services for simplicity), and Function App name.
- Once the Function App is created, navigate to it and create a new function. Select "HTTP trigger" as the template for your Azure Function.
- Code your function to call Azure Cognitive Services using the API key and endpoint URL obtained earlier. Apply necessary logic to process the data received from Trello and return the results back to Trello.
import logging
import azure.functions as func
import requests
def main(req: func.HttpRequest) -> func.HttpResponse:
try:
text = req.params.get('text')
api_key = "<Your-Cognitive-Services-API-Key>"
endpoint = "<Your-Cognitive-Services-Endpoint-URL>"
headers = {"Ocp-Apim-Subscription-Key": api_key}
# Example for Text Analytics API call
response = requests.post(
url=f"{endpoint}/text/analytics/v3.0/sentiment",
headers=headers,
json={"documents": [{"id": "1", "language": "en", "text": text}]}
)
result = response.json()
return func.HttpResponse(f"Sentiment Analysis Result: {result}")
except Exception as e:
logging.error(str(e))
return func.HttpResponse(str(e), status_code=500)
- After function deployment, verify the Function URL as it will be called by Trello to process actions. Include query parameters if needed based on Trello's data exchange format.
Link it All Together
- Use Trello's Butler to set up commands that trigger based on specific criteria or actions on the Trello board. Configure the appropriate HTTP request action that calls your Azure Function.
- For instance, create a Butler rule that triggers an HTTP request to the Azure Function URL whenever a new card is added to your Trello board. Pass relevant card data such as descriptions or attachments as query parameters or in the body of the request.
- Test the full cycle of creating a card in Trello, triggering the Azure Function, and retrieving the processed results back in Trello. Adjust configurations and debug as necessary to ensure seamless integration and desired automation.