同步微博至 Twitter 的新方式

2018/12/14 posted in  少数派 comments

IFTTT 同步微博至 Twitter 的体验太糟糕,最大的缺陷是无法较好地处理文字和附图微博。本文将介绍一种进阶方法,利用 IFTTT 和 Integromat 同步,以解决只用 IFTTT 同步微博的缺陷。

IFTTT & Integromat 同步微博和 Twitter

由于微博 API 限制,IFTTT 同步微博到 Twitter 的体验奇差,无法恰当区分纯文字、带图片的微博和转发微博。而以 Integromat 为纽带建立「微博 & IFTTT & Twitter」之间的联系,则可以解决这些问题。Integromat 可以区分文字微博、附图微博,并过滤转发微博,原理如下:

Integromat is the glue of the internet. Integromat is the most advanced online automation platform. We've redefined work automation so everyone can get back to what matters the most.

设置 IFTTT

设置 IFTTT 的过程比较简单,而 Integromat 的设置比较复杂。

### 创建两个 Applet 分别用于发布文字和附图微博

文字微博

  1. if this Webhooks --> Receive a web request --> Event Name:only_text_weibo --> Create trigger
  2. then that Twitter --> Post a tweet --> Tweet text: {{Value1}}
  3. Creat action

附图微博

  1. if this Webhooks --> Receive a web request --> Event Name:image_text_weibo --> Create trigger
  2. then that Twitter --> Post a tweet with image --> Tweet text: {{Value1}} --> image URL: {{Value2}}
  3. Creat action

Webhook Key
搜索 Webhook,点击 Documentation,记住 Key,形如 mZrddwEydzxxxxxxJeEXE,后面要用到。

设置 Integromat

接收 IFTTT 请求,过滤微博,触发文字微博和附图微博的 Webhooks 规则。用文字描述这个过程较为抽象,可查阅 文字教程,或者更为直观的 图文教程,或者直接导入 我的配置 并加以修改:

① 导入 blueprint.json 后的样子:

② 创建同名 Webhook(因为 Webhook 链接相同,故需要以新创建的方式变更链接):

③ 设置 Data structure:

④ 变更 HTTP 8 链接红圈部分(即设置 IFTTT 时的 Key):

⑥ 变更 HTTP 9 链接红圈部分(即设置 IFTTT 时的 Key):

⑦ 保存并启用。

回到 IFTTT 再次设置

创建同步微博内容到 Integromat 的 Webhook 触发器:

  1. if this:Weibo,选择 New post by you
  2. then that:Webhook,选择 Make a web request,URL 填写设置 Integromat 里面拿到的地址:https://hook.integromat.com/xxxxxxxxxxxxxxxx,Method 选择 POST,Content Type 选择 application/x-www-form-urlencode,Body 填写 text={{Text}}&image={{PhotoURL}}
  3. 点击 Create Action,点击 Finish ……

同步微博的一些限制

  • & 字符及其之后的文字内容无法同步;
  • 文字数超过 Twitter 限制(140)无法同步;
  • 受限于微博 API 只能同步一张照片。

备注:IFTTT & Integromat 同步微博至 Twitter 的方法来自 xiaomingplus,万分感谢允许加工。


扫一扫即可关注微信公众号