Reputation: 28164
the links i created on the dashboard works for deep linking, but the ones i created in the API does not (it works for directing to app, but does not deep link once clicked)
LINKS:
CODE:
HTTP.post("https://api.branch.io/v1/url", :params => {
:branch_key => "KEY",
# also tried not wrapping it in data
:data => {
:linkType => "questions",
:question_id => 1
}
}).to_s
CONSOLE:
Upvotes: 1
Views: 1415
Reputation: 28164
After a lot of testing, and thanks to tips from the amazing Branch support and the debugging tips from Alex above, I finally isolated the situation.
Basically, even tho i was not using this particular parameter in iOS, I needed to add this as part of the parameters.
"$one_time_use": "",
Not doing so basically did not trigger my continueUserActivity - which is weird, even when it is the first time i am using it.
Upvotes: 0
Reputation: 13613
Alex from Branch.io: I'm afraid the syntax you're using to build this API call isn't familiar to me so I can't replicate locally yet.
However, a few things that might help:
You can inspect the contents of a link by appending ?debug=true
to the URL (e.g., https://og75.app.link/6lOctoHLLx?debug=true
). If you do this with both of your links, you'll see the API version is missing the parameters you are trying to set, which is why you don't get correct deep link behavior. Now to figure out why...
Not knowing the syntax of the call you're using in this example, I'm wondering if the data
object is malformed. However, this would usually result in a 400 error with no URL returned, so I'm a little bit puzzled. If you look at our documentation for basic API link creation, you'll see the following cURL example:
Note how the contents of the data
object are actually pre-escaped
curl -X POST \
\
-H "Content-Type: application/json" \
\
-d '{"branch_key":"key_live_feebgAAhbH9Tv85H5wLQhpdaefiZv5Dv", "campaign":"new_product_annoucement", "channel":"email", "tags":["monday", "test123"], "data":"{\"name\": \"Alex\", \"email\": \"[email protected]\", \"user_id\": \"12346\", \"$deeplink_path\": \"article/jan/123\", \"$desktop_url\": \"https://branch.io\"}"}' \
\
https://api.branch.io/v1/url
Perhaps you could try a call with the data
object set as a string, and see if your link comes back with all parameters set? I have no idea if this is valid code for what you're working with, but perhaps something like this:
HTTP.post("https://api.branch.io/v1/url", :params => {
:branch_key => "KEY",
# also tried not wrapping it in data
:data => {\"linkType\": \"questions\", \"question_id\": "1"
}
}).to_s
Upvotes: 1