如何在 golang 项目中生成 branch.io 深层链接

问题描述

我需要在 golang 项目中使用 branch.io 生成带有少量嵌入参数的深层链接。该链接将作为短信发送到安卓手机。因此邀请推荐链接重定向到 Playstore 应用程序。是否有任何 go lang 库或任何方法可以做到这一点?

解决方法

目前,没有专门针对 GoLang 的库/包装器支持。但是,您可以利用 Deep Linking API 来实现您的用例。

示例卷曲 -

curl -XPOST https://api2.branch.io/v1/url -H "Content-Type: application/json" \
-d '{
"branch_key": "key_live_xxxxxxxxx","channel": "facebook","feature": "onboarding","campaign": "new product","stage": "new user","tags": ["one","two","three"],"data": {
 "$canonical_identifier": "content/123","$og_title": "Title from Deep Link","$og_description": "Description from Deep Link","$og_image_url": "http://www.lorempixel.com/400/400/","$desktop_url": "http://www.example.com","custom_boolean": true,"custom_integer": 1243,"custom_string": "everything","custom_array": [1,2,3,4,5,6],"custom_object": { "random": "dictionary" }
 }
}'