2 / 3
Jul 2024

Trying to get a slackbot that I have set up (with full permissions on the associated slack) to correctly be triggered by new documents being added or being updated. I followed this tutorial and put in the appropriate credentials for ‘SLACK_TOKEN’ and ‘CHANNEL_ID’.
Looking at the logs, I get the same error: Logs: [“[object Promise]”] Error:
uncaught promise rejection: {“message”:“Cannot access member ‘content-type’ of undefined”,“name”:“TypeError”

Any help is greatly appreciated!
Cheers
J

Hello!
Your Slackbot error likely stems from an uncaught promise rejection due to an undefined content-type. Ensure the API response includes the expected headers and add error handling with a .catch block to manage promise rejections. For example, log the response headers before accessing content-type to verify it’s defined. This should help resolve the issue.

13 days later

Thanks Marlene. It looks like it was as simple as me using the wrong tokens. Slack API has a bit of a confusing navigation and there are two places with separate credentials. I was using the wrong one (: Appreciate the reply!