How can I create a task in TickTick with a custom title triggered by Telegram Bot?

Hi guys, I’m fiddling with a Telegram bot which I’ve tied in with ChatGPT. This works great, and I can also tell the bot to trigger its own commands by sending it a voice note, so now I want to add Pipedream to connect my Telegram bot with TickTick. I tried giving it the trigger [“/createtask”], and that works great, I can get it to create a task in TickTick… amazing! However, I have to set the task name/title manually in the TickTick step after the trigger, which defeats the purpose of what I’m trying to do. What I’d really like to accomplish is [“/createtask {{taskname}}”], so if I type “/createtask Meeting with John” in Telegram, that task would then added to TickTick… is it even possible?

Hi @jp,

Yes, it’s possible to achieve this by extracting the task name from the message text in your Pipedream workflow. Assuming you’ve already set up the Telegram bot and connected it to Pipedream, you can follow these steps:

  1. After the Telegram bot trigger, add a new “Run Node.js code” step in your workflow.
  2. In the code editor, add the following code to extract the task name from the message text:
const messageText = this.event.body.message.text;
const taskName = messageText.replace("/createtask", "").trim();
return { taskName };
  1. Now, you should have the task name available as an output from the “Run Node.js code” step. You can reference it in the TickTick step using the variable steps.<step_name>.taskName, where <step_name> is the name of the “Run Node.js code” step.

Make sure to replace the hardcoded task name in the TickTick step with the variable mentioned above.

This way, when you send a message like “/createtask Meeting with John” in Telegram, the task “Meeting with John” will be created in TickTick.
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.