2017-07-28 8 views
0

次のカールクエリーをnode.jsリクエストにエンコードする必要があります。 私はそのフォームが仕事を行う必要があります知っているが、私はこのような「ペイロード=」たぶんcurlをnode.jsリクエストで書き直す

curl -X POST --data-urlencode 'payload={"channel": "#tutorial", "username": "webhookbot", "text": "This is posted to #tutorial and comes from a bot named webhookbot.", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/T5NGB8FE0/B6G57N86A/.... 

答えて

1

が何かという扱いがホ分からない:それは働いた

request.post({ 
    url: 'https://hooks.slack.com/services/T5NGB8FE0/B6G57N86A/', 
    form: { 
     payload: '{"channel": "#tutorial", "username": "webhookbot", "text": "This is posted to #tutorial and comes from a bot named webhookbot.", "icon_emoji": ":ghost:"}' 
    } 
    }, (error, response, body) => { 
    //your code 
    } 
); 
+0

!ありがとうございました –

関連する問題