mlava / json-webhooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This extension allows you to export data from Roam Research to a webhook. This can allow connection with services such as Zapier, IFTTT, Integromat/Make and Pipedream.

New:

  • optionally apply a string or tag to the parent block on successfully sent to webhook (e.g. #sent)
  • support Konnectzit in addition to Zapier, IFTTT, Make/Integromat and Pipedream
  • allow a second webhook definition to send to a second source

If you nest childblock data beneath a parent, click into the parent block and then trigge this extension via the Command Palette, it will read the parent and child block data and then format it to send to the defined webhook.

Note that you need to have set up whichever service you're using in advance - stepwise instructions are below.

  • lunch with John
    • Date: tomorrow
    • Time: 1230 pm
    • Location: Rialto Towers

This clip shows how to use the data structure above to make a calendar entry: https://www.loom.com/share/ead9d2d129994cad9c00261925e7ac6d

  • Configuration:

    • Zapier:

      • In Zapier, create a new Zap using the Webhooks by Zapier trigger.
      • Click Continue button
      • Copy the Custom Webhook URL, leave all other options alone and click Continue again
      • Paste the Webhook URL in the Roam Depot settings for this extension
      • Go back to Zapier and click Test Trigger button
      • You should see something like this:
      • Now, click Continue and choose what you want to do with the data... πŸŽ‰
    • IFTTT:

      • Although IFTT can receive webhooks, there are limits in both the number and type of data that can be sent and processed. Unlike Zapier, Integromat and Pipedream, IFTT can only accept pre-defined webhook events with three json values.
      • You need to define the name of the webhook you want to call - go to Choose a trigger - IFTTT and choose Add, then select Webhook.
      • Select Receive a web request and you will be asked to name the event.
      • Then, continue through the usual process of creating an IFTTT applet.
      • Once you have finished, go to your Webhooks works better with IFTTT page and click on Documentation
      • Under Make a POST or GET web request to: you will see a url like:
      • https://maker.ifttt.com/trigger/{event}/with/key/<long alphanumeric string>
      • The {event} string is the name of the event you entered earlier. Type it in the {event} box to reveal the full url.
      • Copy this url and place it in the Roam Depot settings panel.
      • For this script, the parent block will be sent as value1, and the first two child blocks will be sent as value2 and value3. Unlike the other services like Zapier, you can't define the key and are stuck with value1 etc.
      • Use value1, value2 and value3 in your IFTTT applet and enjoy! πŸŽ‰
    • Integromat / Make:

      • The process for Integromat is quite similar to that for Zapier
      • Create a new scenario
      • Select Webhooks and whatever app to which you want to send the data
      • In the scenario, Add Custom webhook
      • Click the Add button to create a new webhook
      • Enter a webhook name and click Save. The Webhook item will generate a URL.
      • Place the Webhook URL in the Roam Depot settings panel
      • Click into the example item below, 'lunch with John', at the end (after 'John')
      • Trigger the extension via the Command Palette
      • Go back to Integromat. Your webhook should receive the data and offer to parse it for you.
      • Connect another app and enjoy sending it your data! πŸŽ‰
    • Pipedream:

      • Go to Sources, click New and select HTTP/Webhook
      • Choose New Requests (Payload Only)
      • Enter a Name and click Create Source
      • You will be shown a box with a header Your endpoint is
      • Place the Webhook URL in the Roam Depot settings panel
      • Click into the example item below, 'lunch with John', at the end (after 'John')
      • Trigger the extension via the Command Palette
      • In the left-sided panel a new event will appear. Click on the timestamp header and the information to the right will show the event data.
      • Click the Create Workflow button to connect your data to another app and enjoy! πŸŽ‰
    • Konnectzit:

      • Click on the button 'Create Konnectz'
      • From Integrated Apps, drag the icon for Webhook onto the working area
      • Copy the Webhook URL and then click on the button 'Capture Webhook Response'
      • Place the Webhook URL in the Roam Depot settings panel
      • Click into the example item below, 'lunch with John', at the end (after 'John')
      • Trigger the extension via the Command Palette
      • In Konnectzit, the data you sent to your Webhook should appear. Connect your Webhook to other apps and Save and then Publish your workflow. πŸŽ‰
    • Choice of Delimiter:

      • Choose which delimiter you wish to use to separate the child block key:value pairs.
        • For example, you could use Date: Tomorrow which uses : as the delimiter
        • The script will then send a key:value pair of key "Date" and value "Tomorrow" in the json data
        • You could choose any sequence of characters, like ;: or even just ,
        • e.g.
          • Date: Tomorrow
          • Date;: Tomorrow
          • Date, Tomorrow
        • The extension will strip leading and trailing spaces so it will still appear as "Date" and "Tomorrow" in the data sent to the webhook
        • Enter your preferred delimiter in the Roam Depot settings panel
      • You might choose to have some simple text fields without a delimiter. In this case, they will be sent as a key:value pair of "string__n__":"string of text"
        • You can mix and match with some child blocks having simple text and others having delimited text.
        • Note: for IFTTT your text will be sent as "value__n__":"string of text"
      • Finally, you don't have to use child blocks. If you trigger the SB in a block without children it will simply send a single key:value pair of "parentText" and the text in the block as the value.

About


Languages

Language:JavaScript 100.0%