Ad Widget

Collapse

Slack Webhook - Change message

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmburgess
    Junior Member
    • Mar 2019
    • 12

    #1

    Slack Webhook - Change message

    Looking at the script that comes with the slack webhook, Its difficult to understand.

    All i need is Issue: trigger name on host name
    And: resolved: triggername on hostname.

    Any help with changing the message that the slack webhook sends?
    Last edited by dmburgess; 11-05-2020, 15:22.
  • dmburgess
    Junior Member
    • Mar 2019
    • 12

    #2
    Ok, got most of it gone. But I can't get the hostname in the title

    Code:
    function createMessage(
    status,
    event_severity_color,
    event_date,
    event_time,
    problem_url,
    isShort,
    messageText
    ) {
    var message = {
    fallback: '{0}: {1}'.format(status, params.event_name),
    title: '{0}: {1}'.format(status, params.event_name),
    color: event_severity_color,
    title_link: problem_url,
    pretext: messageText || '',
    
    fields: [
    {
    title: 'Host', value: '{0} [{1}]'.format(params.host_name, params.host_ip),
    short: true
    }
    
    ],
    };
    
    
    
    return message;
    }
    Last edited by dmburgess; 11-05-2020, 15:27.

    Comment

    Working...