代码之家  ›  专栏  ›  技术社区  ›  ambikanair

如何使用bot将文件上载到空闲通道

  •  0
  • ambikanair  · 技术社区  · 6 年前

    我有一个松懈机器人和令牌开始 xoxb

    我使用下面的格式

    curl -F token="${SLACK_TOKEN}" -F file=e2e.sh -F channel="${SLACK_CHANNEL}" -F  as_user=true https://slack.com/api/files.upload
    

    这个扔

    {"ok":false,"error":"no_file_data"}
    
    1 回复  |  直到 6 年前
        1
  •  2
  •   Stefanos Chrs    6 年前

    你错过了 @ 在你的 file=e2e.sh 参数让curl知道您要传输文件。下面应该可以做到这一点:

    curl \
      -F token="${SLACK_TOKEN}" \
      -F file=@e2e.sh \
      -F channel="${SLACK_CHANNEL}" \
      -F as_user=true \
      https://slack.com/api/files.upload