Open mlava opened 3 years ago
I adapted this to send a Google Hangouts Chat message to my team chat room with Integromat --> GChat
I had to change the code line 31 (below) in order to get the data right.
"data": JSON.stringify(blocks)
to
"data": blocks
BTW, this is AWESOME! Thank you for making this happen.
Thanks, Jason. New version for download in the first post which detects the webhook URL for either Zapier, Pipedream or Integromat, and then modifies the ajax call as needed. Cheers!
I wonder if this was my problem this morning. I was trying to convert it for IFTTT, which requires a 3 value JSON data package and it was not accepting the JSON even though it would create the event.
Hi Mark @Calhistorian Can you clarify what you mean? Or maybe send me the required format and I will see if we can make a version for IFTTT. Cheers! Mark
Edit: I found this format?
Make a POST or GET web request to:
https://maker.ifttt.com/trigger/{event}/with/key/{key}
With an optional JSON body of:
{ "value1" : "", "value2" : "", "value3" : "" }
I will modify the script to do this for IFTTT tonight.
New version in the first post.
Allows for IFTTT webhooks @Calhistorian
I actually use Integromat, Zapier, and IFTTT. I have multiple webhooks at each service for various actions. Rather than make individual copies of the script that each read a different 42Setting, is there a way to have 42Settings for each webhook and pass to the script the exact one I am wanting it to use? For instance, I have several webhooks that are all Integromat.
Hi Jason. Yeah, I've been pondering that too. You can send data to SBs with a button and then do different things depending on the data, but I don't know how to do it with the jj trigger and I don't think you really want to have to put a button there before triggering the SB.
Perhaps you could include a string in the text item in Roam that is parsed and then chooses which workflow to follow. I imagine it would be quite idiosyncratic, and need personalisation for each user.
I'll ponder how the flow might work, but I had already been considering this use case and hadn't gotten much further than multiple copies of the block with different settings, I'm afraid...
v0.5 in first post.
This version handles the situation if you don't use a delimiter in your child block.
As there isn't a key defined (no delimiter) it will use 'string' instead. i.e.
For Zapier, Integromat and Pipedream, where n is the order within number of non-delimited child blocks you have, it will send
"stringn":"string of text"
For IFTTT it will still send value1 etc as before.
I would like to see if this code could be modified to do the following so I can easily move tasks to Asana one at a time without having to create the child blocks. What I am looking to do is this:
Steps to move task to Asana
How hard would that be? My JS skills are lacking.
Updated to v 0.6.
Thanks @PJJPtx for reporting issue with block refs that contain hyphens and creating the fix.
@PJJPtx re your question from here - let me take a look and get back to you.
I have a shared Roam Research Graph containing all of my Roam42 SmartBlocks, RoamJS and RoamCSS scripts.
You can find it here.
โ๏ธ Copy of your #42SmartBlock from Roam
Roam JSON to Webhook 0.6.zip
๐ Describe the SmartBlock
This SmartBlock allows you to post a parent block and its children as JSON to a webhook. This could be Zapier, IFTTT, Integromat or Pipedream. Others might work but might need some tweaks to the code.
For Zapier, Integromat and Pipedream:
For IFTTT:
Note that the limited utility of the IFTTT webhook is a limitation of IFTTT not this script... ๐๐คจ
Completed to fulfill a bounty posted by @syncretizm on Twitter. https://twitter.com/syncretizm/status/1359751288859185152
โ Describe any prerequisites or dependencies that are required for this SmartBlock
Roam42.
Zapier Premium. IFTTT. Integromat. Pipedream. Or another service that accepts webhooks with JSON data payloads.
๐ท Screenshot of your #42SmartBlock workflow/template from Roam
This is an example of a block that might be used to create a calendar entry. However, you can put whatever information you like in the block.
Whatever is to left of the : in the child blocks will become a key and the value to the right will become a value. The parent block text is inserted into the json file as title.
The object will look like:
{"title":"lunch with John","Date":"tomorrow","Time":"1130 am","Location":"Rialto Towers"}
(IFTTT:
{"value1":"lunch with John","value2":"tomorrow","value3":"1130 am"}
)You will then have access to the title and each of the attributes as data in Zapier to send to another app. You can then do whatever you like with those key:value pairs.
An alternate example might be:
For which the JSON object will look like:
{"title":"Digital Minimalism","Author":"Cal Newport","Keywords":"books","Full Title":"Digital Minimalism"}
(IFTTT:
{"value1":"Digital Minimalism","value2":"Cal Newport","value3":"books"}
)This would be useful for an entirely different type of Zap.
๐ก Additional Info
https://www.loom.com/share/c361eaa60267456098cc141c1499a913
I have a shared Roam Research Graph containing all of my Roam42 SmartBlocks, RoamJS and RoamCSS scripts.
You can find it here.