Action

Send to LunaTask

Posted by Aaron Krall, Last update 10 months ago

This is a simple script that sends a Draft to LunaTask as a new task.

JUst replace the apiKey and areaId with yours and you’re good to go!

Steps

  • script

    let http = HTTP.create(); // create HTTP object
    
    let draftContent = draft.content;
    let endpoint = 'https://api.lunatask.app/v1/tasks'; 
    let apiKey = 'eyJraWQiOiIyZDhlZTk0M2NhODhiMTJmZTRhZjZmYWRhOWM2ZDc2Y2ZkZTdmMWRlZmY0YjQwNzViYTgzMGJjYjkwNGEyYzNlIiwiYWxnIjoiUlM1MTIifQ.eyJhdWQiOiJhcGkiLCJzdWIiOiJiZTliYmZkYy1jM2FiLTQxN2YtOTZiNS03MTExOTFhOTQ0MTkiLCJqdGkiOiI4MzRkMTkxMC1iMTdhLTRhZjctOTdkNS04OWIyNjFkMDQ1ZGEifQ.ALURJT8MjlUra3Doaqnq2xnNBo7QOGBaG1xhWClYVPCduhvVnzlqIId4XgzPGchu1oft-ltBwDXlKJ0Y8kveV9CyQtF_EncwaJRnxsTU8JY9_Hv3uoCXKs9rC-6U2vr_d5kNQFJUBHzOlJRk2rq5G-YqydUmodNVf4hbKZpOtCct2exPGRn7-oW29v0bRecieveXk8FCK2YgUzpeqY2ncb2raQoP-m6bd_Q-qCIcQuO926ECJ2X9HeY9Wohv209jqXKUvSLXtNUkGvOYSzIkfBEt5zeBU44y6ZG-PBA8fLhtL2d-BDYW9xBm6OjDzMJVTRevyJFo9vIYLSLwLqa1Vw'; // replace with your LunaTask API key
    let areaId = '4859b54f-fe27-4326-9421-17c228ef308f'; // replace with your desired Area ID
    
    let response = http.request({
        "url": endpoint,
        "method": 'POST',
        "data": {
            "name": draftContent,
            "area_id": areaId
        },
        "headers": {
            "Authorization": "Bearer " + apiKey,
            "Content-Type": "application/json"
        }
    });
    
    if (response.success) {
        let text = response.responseText;
        console.log(text); // log response for debugging
    } else {
        console.log(response.statusCode);
        console.log(response.error);
    }
    

Options

  • After Success Archive , Tags: sent to luna task
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.