同步微博到推特或脸书
前期准备
- 在 [IFTTT][1] 注册一个帐号
- 在 [integromat][2] 注册一个帐号
这两个网站均可以用 Google 或 FB 帐号登录。
在 [IFTTT][3] 上添加 “发送新微博的触发”
连接 Weibo 、Facebook 、Twitter
- 在 IFTTT 的主页面,点击 Search
- 分别搜索 Weibo 、Facebook 、Twitter
- 以 Weibo 为例,搜索框输入 Weibo 之后,点击 Services 下的图标,在弹出的新页面选择授权
同步原创纯文本微博
1. Facebook
- 点击在右上角用户名下拉框,选择 New Applet
- 点击页面上蓝色字 this
- 在 Search services 搜索 webhook,依次点击 webhook -> Connect -> Receive a Web request,在 Event Name 中填写 TextWeibo,点击 Creat trigger
- 点击页面上蓝色字 that
- 在 Search services 搜索 Facebook,依次点击 Facebook -> Creat a status message,Status message 中填写 ,点击 Create action
- 点击 Finish
2. Twitter
- 点击在右上角用户名下拉框,选择 New Applet
- 点击页面上蓝色字 this
- 在 Search services 搜索 webhook,依次点击 webhook -> Connect -> Receive a Web request,在 Event Name 中填写 TextWeibo,点击 Creat trigger
- 点击页面上蓝色字 that
- 在 Search services 搜索 Twitter,依次点击 Twitter -> Post a tweet,Tweet text 中填写 ,点击 Create action
- 点击 Finish
同步原创带图片微博
1. Facebook
- 点击在右上角用户名下拉框,选择 New Applet
- 点击页面上蓝色字 this
- 在 Search services 搜索 webhook,依次点击 webhook -> Connect -> Receive a Web request,在 Event Name 中填写 ImageWeibo,点击 Creat trigger
- 点击页面上蓝色字 that
- 在 Search services 搜索 Facebook,依次点击 Facebook -> Upload a photo from URL,Message 中填写 ,Photo Url 中填写 ,点击 Create action
- 点击 Finish
2. Twitter
点击在右上角用户名下拉框,选择 New Applet
点击页面上蓝色字 this
在 Search services 搜索 webhook,依次点击 webhook -> Connect -> Receive a Web request,在 Event Name 中填写 TextWeibo,点击 Creat trigger
点击页面上蓝色字 that
在 Search services 搜索 Twitter,依次点击 Twitter -> Post a tweet with image
,Tweet text 中填写 ,Image URL 填写 ,点击 Create action
- 点击 Finish
webhook 的触发地址
- 点击在右上角用户名下拉框,选择 Services
- 搜索 Webhooks
- 点击 Documentation
- 将 Key 记下来
因为 IFTTT 发送带图片和不带图片是不同的方式,所以必须设置两个 IFTTT 的 APPLET
通过 [integromat][4] 将两条规则分发
1. 设置 webhook
选择 Create a new scenario
点击?号图标,搜索 webhook
依次选择 webhooks -> Custom Webhook
点击 Webhooks 的图标,点击下拉框旁的 Add
Webhook name 填写 IFTTT weibo webhook
点击左下角的 Show advanced settings
Data structure 右侧点击 Add
Data Structure name 填写 Weibo data structure
点击 Generator
Content type 选择 Query String
Sample data 填写:text=text&image=imageUrl
点击 Save , 点击 Add data structure 表单的 Save,点击 Add a hook 表单的 Save
![webhook][image-1]
2. 测试是否正常工作
- 复制 Webhooks 表单中给出的 URL
- 在这个 URL 后面拼接 ?text=text&image=imageUrl
- 在浏览器地址栏中粘贴
- 若 Webhooks 表单给出 Successfuly determined 表示成功运转
- 然后将 Webhooks 表单中给出的 URL 记录下来
![测试运转][image-2]
3. 设置 Router
点 webhook 图标右边的半圆,选择 Router
设置第一条
- 点第一条分支的虚线中间部分,点击 set up a filter
- Lable 填 Image weibo,Condition 输入框选左边的 image,下拉框选择 exists,点击 ok
- 点击这条分支的末端图标问号,搜索 HTTP
- 点击 HTTP,选择 Make a request
- 在 https://maker.ifttt.com/trigger/imageWeibo/with/key/ 后加上在 IFTTT 步骤记录下来的 Key
- Method 选择 POST,Body Type 选择 application/x-www-form-urlencode
- 点击 Add item,Key 填 value1,点击 value 的输入框,选择 text
- 点击 Add item,key 填写 value2,点击 value 的输入框,选择 image
- 点击 ok
设置第二条
- 点第二条分支的虚线中间部分,点击 set up a filter
- Lable 填 Text weibo,Condition 输入框选左边的 image,下拉框选择 Does not exist
- 点击右下角 Add and rule,点击输入框,选择 text,下拉框选择 Dose not matches Pattern (case insensitive),下面的输入框输入 (Repost)|(转发微博)|(//)|( 轉發微博,点击 ok
- 点击这条分支的末端图标问号,搜索 HTTP
- 点击 HTTP,选择 Make a request
- 在 https://maker.ifttt.com/trigger/imageWeibo/with/key/ 后加上在 IFTTT 步骤记录下来的 Key
- Method 选择 POST,Body Type 选择 application/x-www-form-urlencode
- 点击 Add item,Key 填 value1,点击 value 的输入框,选择 text
- 点击 ok
上述步骤完成后,点击右下角保存,并确定此 scenarios 正在运行
在 IFTTT 中创建触发器
- 点击页面上蓝色字 this
- 在 Search services 搜索 weibo,选择 New post by you,点击 Creat trigger
- 点击页面上蓝色字 that
- 在 Search services 搜索 webhook,选择 Make a Web request,在 URL 中填写在 integromat Webhooks 表单中拿到的 URL,点击 Create action
- 点击 Finish
然后就可以同步微博上的原创微博了
[1]: https://ifttt.com/
[2]: https://www.integromat.com/
[3]: https://ifttt.com/
[4]: https://www.integromat.com/
[image-1]: webhook.gif
[image-2]: %E6%B5%8B%E8%AF%95%E8%BF%90%E8%BD%AC.jpg