Skip to content

Instantly share code, notes, and snippets.

@pimentelra
Last active May 31, 2019 09:18
Show Gist options
  • Save pimentelra/f8d2ff99ba41c52dd51534151f9d9f4f to your computer and use it in GitHub Desktop.
Save pimentelra/f8d2ff99ba41c52dd51534151f9d9f4f to your computer and use it in GitHub Desktop.
Tasker profile to auto share a Citymapper trip with a Telegram channel
Profile: Citymapper Auto Share (16)
Application: Citymapper
Event: AutoInput UI Action [ Configuration:Action Types: Clicks Element Text: Go ]
Enter: Auto Share Citymapper Trip (10)
A1: Stop [ With Error:Off Task: ] If [ %aielementid !~ *go_and_book_go_text* ]
<trip_share>
A2: AutoInput UI Query [ Configuration:App Package: com.citymapper.app.release Timeout (Seconds):5 ]
A3: If [ %aiid() !~ *on_journey_eta_mins* ]
A4: Stop [ With Error:Off Task: ] If [ %qtime > 10 ]
A5: Wait [ MS:20 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A6: Goto [ Type:Action Label Label:trip_share ]
A7: End If
A8: AutoInput Action [ Configuration:Type: Id Value: com.citymapper.app.release:id/on_journey_eta_container Action : Click Timeout (Seconds):2 ]
<trip_url>
A9: AutoInput UI Query [ Configuration:App Package: com.citymapper.app.release Text: citymapper.com/eta Variables: share_url Timeout (Seconds):10 ]
A10: AutoInput Global Action [ Configuration:Action: Back Timeout (Seconds):20 ]
A11: Variable Set [ Name:%post_trip_attempt To:0 Recurse Variables:Off Do Maths:Off Append:Off ]
<trip_post>
A12: HTTP Post [ Server:Port:https://api.telegram.org Path:/BOT_ID:TOKEN/sendMessage?parse_mode=markdown&disable_web_page_preview=true&chat_id=CHAT_ID&text=I'm on the way: %share_url Data / File: Cookies: User Agent: Timeout:10 Content Type:application/json Output File: Trust Any Certificate:On ]
A13: If [ %err > 0 & %post_trip_attempt < 10 ]
A14: Flash [ Text:No connectivity! Long:Off ]
A15: Stop [ With Error:Off Task: ] If [ %qtime > 200 ]
A16: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ]
A17: Variable Add [ Name:%post_trip_attempt Value:1 Wrap Around:0 ]
A18: Goto [ Type:Action Label Label:trip_post ]
A19: End If
A20: Flash [ Text:Trip successfully shared! Long:Off ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment