# Link Obsidian with AdvancedURI Plugin

**URL:** https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691
**Category:** Discussion & Help
**Created:** [February 19, 2022, 9:10am UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691 "2022-02-19T09:10:44Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [February 28, 2022, 6:09pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/21 "2022-02-28T18:09:48Z")

</div>

Because different apps might have different naming convention, we can’t ask them to put the url value to a specific url parameter name because they also need deal with x-callback-url from other different apps.

Ideally, the parameter name for url is “url” and the parameter name for title is “title”. But it is not always the case. If those parameters are not standard(“url” or “title”), we will append “urlkey” or “titlekey” paramter-value pairs to hook’s x-callback-url. So later, when Hook processes this x-callback-url action, it knows which parameter is for url and which parameter is for title.

That’s why I asked you to pass the whole url of x-success, including parameters, if there is any.

Thank you

---

<div class="post-metadata">

### Author: ![Vinzent03](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/vinzent03/32/2126_2.png) [@Vinzent03](https://discourse.hookproductivity.com/u/Vinzent03)
#### Post date: [February 28, 2022, 6:55pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/22 "2022-02-28T18:55:15Z")

</div>

Ah, interesting. I released now the new version. With [these changes](https://github.com/Vinzent03/obsidian-advanced-uri/commit/daf9d56fe6317f3e1e6e5bea3b74abd69d5ef793)

---

<div class="post-metadata">

### Author: ![Vinzent03](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/vinzent03/32/2126_2.png) [@Vinzent03](https://discourse.hookproductivity.com/u/Vinzent03)
#### Post date: [February 28, 2022, 7:01pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/23 "2022-02-28T19:01:41Z")

</div>

As stated on your website regarding Obsidian: [Using Hook with Obsidian – Hook](https://hookproductivity.com/help/integration/using-hook-with-obsidian/) You say that `Hook to New` is not supported. Do you mean an uri, which creates a new file in Obsidian? ~~My plugin does support this. So should we add that feature too?~~ Obsidian supports this out of the box.

---

<div class="post-metadata">

### Author: ![Wen](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/w/f9ae1b/32.png) [@Wen](https://discourse.hookproductivity.com/u/Wen)
#### Post date: [February 28, 2022, 7:36pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/24 "2022-02-28T19:36:47Z")

</div>

Considering Advanced URI’s support on Daily notes, would it also be possible to achieve the following when hooking an item to a daily note in Obsidian?

- The Markdown link of the item would be obtained.
  - In the case of PDF Deep Linking, the selected text together with the Markdown link of the PDF file would be obtained.

- A new daily note would be created by using the corresponding daily note template specified in Obsidian, if the daily note does not exist yet.
- The Markdown link would be inserted to the end of the desired header within the daily note.

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [February 28, 2022, 10:19pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/25 "2022-02-28T22:19:09Z")

</div>

Thank you! It works great! Due to a bug in the current release, it won’t work in the current release. We will have a new release.

Just one minor thing, I have a note with title “my notes 10”. In the x-callback-url, it is “my+notes+10”. Is it possible that it is encoded as “my%20notes%2010”?  
hook://x-callback-url/setCurrentNode?urlKey=advanceduri&title=my+notes+10&advanceduri=obsidian%3A%2F%2Fadvanced-uri%3Fvault%3Dmergepbx-master%26uid%3D8a8563cf-637d-4685-a9aa-ae770a5e0faa&urlkey=advanceduri

---

<div class="post-metadata">

### Author: ![Vinzent03](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/vinzent03/32/2126_2.png) [@Vinzent03](https://discourse.hookproductivity.com/u/Vinzent03)
#### Post date: [February 28, 2022, 10:54pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/26 "2022-02-28T22:54:49Z")

</div>

Both should be valid, right? I’m using a provided `URL` class to easily add params. I can’t change the encoding for `<space>`. I doubt that it causes any trouble, if so I would have to do the things more manually.

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [February 28, 2022, 11:18pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/27 "2022-02-28T23:18:20Z")

</div>

Definitely not manually change the encoding.

If “my+notes+10” is ok, then no change is necessary.

Thank you

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [March 1, 2022, 9:28pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/28 "2022-03-01T21:28:00Z")

</div>

Do you mean Obsidian’s new action?

> **[Using obsidian URI](https://help.obsidian.md/Advanced+topics/Using+obsidian+URI)**
>
> Using obsidian URI

It does create a new note. The reason currently Hook is not able to use is that Hook is not able to get the url of the new note. Also the new note’s title. Because sometimes the new note’s title is different than the one in the new action url, if the note name exists already.

Perhaps there is some misunderstanding. Please correct me if that’s the case,

If advanced uri plugin has x-callback-url support for this, that would be great. Could you please let me know its action name and the parameters?

Thank you

---

<div class="post-metadata">

### Author: ![Vinzent03](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/vinzent03/32/2126_2.png) [@Vinzent03](https://discourse.hookproductivity.com/u/Vinzent03)
#### Post date: [March 1, 2022, 10:31pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/29 "2022-03-01T22:31:57Z")

</div>

My plugin doesn’t provide it yet, but I’m open to add that too. What is Hook’s “default” behavior for already existing files? Should I return an error message via `x-error` callback? Do you pass a title, or should it just generate a new file with Obsidian’s default new file name?

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [March 2, 2022, 2:12am UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/30 "2022-03-02T02:12:53Z")

</div>

> [@Vinzent03](#):
>
> What is Hook’s “default” behavior for already existing files? Should I return an error message via `x-error` callback?

Hook’s behavior is the same, regardless of whether the file exists or not.  
If a file exists, Hook expects Obsidian will create a new note with a different name, and pass the note url and title back to Hook in x-callback-url. If not, use the title Hook passes in to create a new file and pass the note url and title back to Hook in x-callback-url.

Basically, we are expecting something similar to Obsidian’s new action, and more. Hook will:

1. Pass a note title to Obsidian without vault name, because Hook does not know which vault to use. Obsidian’s new action allows new note without vault name.  
[https://help.obsidian.md/Advanced+topics/Using+obsidian+URI#Action+new](https://help.obsidian.md/Advanced+topics/Using+obsidian+URI#Action+new)

2. Pass src link’s mark down link to Obsidian as note’s content. It seems users like this.

3. Pass Hook’s x-callback-url to Obsidian. It will have some parameters. Obsidian appends the new note’s url and title to the url of x-success and generates a new x-callback-url.

The following is an example url that is used to create a new Craft note.  
craftdocs://createdocument?title=mymetac.xcodeproj&content=mymetac.xcodeproj&x-success=hook://x-callback-url/link-to-new%3FurlKey%3Dlink%26src%3Dhook://file/9cxEDQk2M%253Fp%253Dc3JjL215bWV0YWM%253D%2526n%253Dmymetac%25252Excodeproj%26title%3Dmymetac.xcodeproj&x-error=hook://x-callback-url/link-to-new-error

And the following is x-callback-url from Craft  
hook://x-callback-url/link-to-new?urlKey=link&src=hook://file/9cxEDQk2M?p%3Dc3JjL215bWV0YWM%3D%26n%3Dmymetac%252Excodeproj&title=mymetac.xcodeproj&spaceId=5da14827-8aef-4318-46f8-e11c8273acaa&blockId=3D4C4032-1619-400D-92B2-3EF82A6BAF8D&link=craftdocs://open?blockId%3D3D4C4032-1619-400D-92B2-3EF82A6BAF8D%26spaceId%3D5da14827-8aef-4318-46f8-e11c8273acaa

---

<div class="post-metadata">

### Author: ![Vinzent03](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/vinzent03/32/2126_2.png) [@Vinzent03](https://discourse.hookproductivity.com/u/Vinzent03)
#### Post date: [March 2, 2022, 4:04pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/31 "2022-03-02T16:04:47Z")

</div>

Ok I think I’m finished implementing (not published yet). The only thing I don’t understand is the `src` param.

> Pass src link’s mark down link to Obsidian as note’s content. It seems users like this.

So `src` as file content, but isn’t `content` used for that?

Is it possible to use the param `data` instead of `content` for file content? That’s what I’m using currently everywhere.

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [March 2, 2022, 5:51pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/32 "2022-03-02T17:51:39Z")

</div>

Sorry for the confusion. I should say source link’s markdown link instead of saying src link’s markdown link. Any name of Obsidian url’s parameter is your call. I will use those names when I create a Obsidian’s url.

The src parameter in the example url is part of Hook’s callback url, just like urlkey parameter I mentioned in the previous posts. It will eventually be passed back to Hook so Hook can create a proper link between two documents.

Thank you very much for your quick action!

---

<div class="post-metadata">

### Author: ![Vinzent03](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/vinzent03/32/2126_2.png) [@Vinzent03](https://discourse.hookproductivity.com/u/Vinzent03)
#### Post date: [March 2, 2022, 6:17pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/33 "2022-03-02T18:17:07Z")

</div>

Sorry, I still don’t get `src`. What exactly is the source? Is it a link of the new created file (where I don’t see a difference to the generated `advanceduri`)? Or is it just the generated uri wrapped in a Markdown format `[title](uri)`?

> Hook can create a proper link between two documents.

Which two documents?

“Hook to new” just creates a new file and gets the file’s link immediately back, right?

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [March 2, 2022, 6:30pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/34 "2022-03-02T18:30:10Z")

</div>

Sorry for the confusion.

When I say the source, I mean the document(or web page, etc.) from which the user invoke link to new action. The is one of the two documents I mentioned in the previous post. The other one is the newly created file.

> [@Vinzent03](#):
>
> “Hook to new” just creates a new file and gets the file’s link immediately back, right?

That’s correct. That’s all Hook needs.

You don’t need touch src parameter in the Hook x-callback-url. Just pass the whole hook x-callback-url +new note’s url and title back to Hook.

Thank you

---

<div class="post-metadata">

### Author: ![Vinzent03](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/vinzent03/32/2126_2.png) [@Vinzent03](https://discourse.hookproductivity.com/u/Vinzent03)
#### Post date: [March 2, 2022, 6:43pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/35 "2022-03-02T18:43:22Z")

</div>

Ahh. The problem is, I don’t know Hook and don’t even own a Mac, so I can’t test Hook.  
Released a new version. Please let me know if everything is working correctly.

Example: `obsidian://advanced-uri?filepath=test&data=myDataToWrite&mode=new&x-success=https%3A%2F%2Fgoogle.com`

- `data` for file content
- `filepath` for title
- instead of `hook-get-advanced-uri` it’s now just `advanced-uri`

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [March 3, 2022, 12:39am UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/36 "2022-03-03T00:39:17Z")

</div>

It works great!

I noticed that AdvancedURI Plugin return urlkey on HookSuccess:  
urlkey: “advanceduri”

I have included urlKey parameter in Hook’s x-callback-url, so that can be taken out. Though it does not affect Link to new action.

Thank you!

---

<div class="post-metadata">

### Author: ![LucB](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/lucb/32/2228_2.png) [@LucB](https://discourse.hookproductivity.com/u/LucB)
#### Post date: [March 3, 2022, 3:13am UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/37 "2022-03-03T03:13:11Z")

</div>

This is fantastic, and we will update our script based on it, and we’ll update [Using Hook with Obsidian – Hook](https://hookproductivity.com/help/integration/using-hook-with-obsidian/). Thank you _so much_ for helping Hook users get more out of Obsidian, and vice versa.

One last thing that would be super useful would be a method that returns **the full (absolute) path of the current document** in obsidian (a traditional file:// URL would do). This would be useful even without adding any special ID to the page. Ideally, this would be in Obsidian itself, but Obsidian doesn’t have such automation as far we know.

This would allow users to do lots of extra stuff with the resource via automation. In particular, Hook would be able to reveal the note in the Finder. Users could then communicate with macOS to do all kinds of things with the file.

**Note to Hook users** : in Hook’s new integration with Obsidian , and going forward, Hook will read advanced parameters (Terminal defaults) to determine which URL format to use. Most users won’t need to copy/paste scripts anymore. You’ll just need to set a Terminal defaults to get an alternative script.

---

<div class="post-metadata">

### Author: ![Vinzent03](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/vinzent03/32/2126_2.png) [@Vinzent03](https://discourse.hookproductivity.com/u/Vinzent03)
#### Post date: [March 3, 2022, 8:12am UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/38 "2022-03-03T08:12:03Z")

</div>

An example of such url is `file:///home/vinzent/desktop/obsidian-testing/2021-11-13.md`, right?

How are spaces handled? Should I just include them eg. `file:///home/vinzent/desktop/obsidian-testing/2021 11 13.md`. Or encode too? But the slashes need to stay, so I have to only encode the file names and dir names?

Can we just include that information in the original `obsidian://hook-get-advanced-uri` url? So I pass not only the obsidian uri, but also the file url?

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [March 3, 2022, 7:08pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/39 "2022-03-03T19:08:06Z")

</div>

> [@Vinzent03](#):
>
> An example of such url is `file:///home/vinzent/desktop/obsidian-testing/2021-11-13.md`, right?

Yes

> [@Vinzent03](#):
>
> How are spaces handled? Should I just include them eg. `file:///home/vinzent/desktop/obsidian-testing/2021 11 13.md`. Or encode too? But the slashes need to stay, so I have to only encode the file names and dir names?

Since it is a value of a parameter, I guess the whole path needs be encoded, including slashes.

> [@Vinzent03](#):
>
> Can we just include that information in the original `obsidian://hook-get-advanced-uri` url? So I pass not only the obsidian uri, but also the file url?

It is an excellent idea

Thank you

---

<div class="post-metadata">

### Author: ![Vinzent03](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/vinzent03/32/2126_2.png) [@Vinzent03](https://discourse.hookproductivity.com/u/Vinzent03)
#### Post date: [March 3, 2022, 7:51pm UTC](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691/40 "2022-03-03T19:51:18Z")

</div>

Encoding it in the whole uri for sure, but I was/am unsure for encoding the file uri alone.

From the following uri

`obsidian://advanced-uri?vault=obsidian-testing&filepath=example%2520file&data=ss&mode=new&x-success=https%3A%2F%2Fgoogle.com`

this is the callback url  
`https://www.google.com/?title=example+file+1&advanceduri=obsidian%3A%2F%2Fadvanced-uri%3Fvault%3Dobsidian-testing%26filepath%3Dexample%2520file%25201.md&urlkey=advanceduri&fileuri=file%3A%2F%2F%2F%2Fhome%2Fvinzent%2Fdesktop%2Fcoding%2Fobsidian-testing%2Fexample%2520file.md`

You see I pass the file uri via `fileuri`.  
Everything correct?

[Previous page](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691.md?page=1)

[Next page](https://discourse.hookproductivity.com/t/link-obsidian-with-advanceduri-plugin/4691.md?page=3)
