Skip to main content

Custom Server Notification for Slack Not Working

Comments

5 comments

  • cPanelKenneth
    Hi, At a guess, you need to redo how your post handler works. Slack appears to require an Authorization header with the token (based upon Using OAuth 2.0). I also suggest liberal use of print statements, and Data::Dumper statements, during your development and testing stages. Remove both prior to production use though. I often print simple phrases like sub send{ print print "Entered Cpanel::iContact::Provider::send function\n"; ...
    Those simple statements, used frequently in your code, can help pinpoint where the errors and failures are occurring. Data::Dumper can be used to output data structures. Both will help you see what is going on.
    0
  • Bruno Morais
    Hi Kenneth, I'm using a Legalacy Token and not OAuth2. For instance ot send a message to channel I can make a curl call in console: curl -X POST https://slack.com/api/chat.postMessage --data "token=xoxp-xxxxxxxxxx-xxxxxxxxxxx-xxxxxxxxxxx-xxxxxxxxxxxxx&channel=#cpanel&text=Test&as_user=false&username=cpanel01.smartevolve.com&pretty=1"
    This curl request is working. This is regular POST with some query string data. I cant find the Cpanel::Posturl class reference to read about it. Just tried to figure out with other notification modules. Comparing with another modules, I believe it is correct. Do you see any error in my POST call? Thanks for the help. Regards, Bruno Morais
    0
  • Bruno Morais
    Hi Michael, That helped a lot. A different approach with webhook in Slack side but working good. Thanks for the help. Regards, Bruno Morais
    0
  • cPanelMichael
    Hi Bruno, I'm glad to see that helped. I've marked this thread as solved. Thanks!
    0

Please sign in to leave a comment.