0

I am trying to use slack API to create a poll functionality. I sent data to slack API URL - 'https://hooks.slack.com/services/TXXXXX/BXXXX/XXXXXX'

I sent post method and params are text: '/poll "Which design is best?" "Round" "Square" "Triangular" anonymous', but it's not working...how to send command in slack API params??

How to create a poll??

const payload = {
  text: '/poll "Which design is best?" "Round" "Square" "Triangular" anonymous',
};

axios('https://hooks.slack.com/services/TXXXXX/BXXXX/XXXXXX', {data: JSON.stringify(payload), 
method: 'post'})
user269867
  • 3,266
  • 9
  • 45
  • 65
zuuuuuuuu
  • 15
  • 4
  • Does this answer your question? [Slack API send commands via webhook](https://stackoverflow.com/questions/46829778/slack-api-send-commands-via-webhook) – Erik Kalkoken Dec 10 '19 at 01:32
  • oh thank you! :) how can I show webhook token ? for example xoxp-xxxxx-xxxxxx – zuuuuuuuu Dec 10 '19 at 02:26
  • to use this particular method you need a legacy token. follow this link: https://api.slack.com/custom-integrations/legacy-tokens – Erik Kalkoken Dec 10 '19 at 02:40
  • chat.commads api is only use legacy token??? I create slack app. but is not workgin . missing_scope erorr.. help me – zuuuuuuuu Dec 10 '19 at 06:57
  • yes, it's an undocumented method and it only works with legacy tokens, not with tokens created from Slack apps. – Erik Kalkoken Dec 10 '19 at 11:35

0 Answers0