Javascript to send slack notification from zabbix is not working

I have a javascript to send slack notification from zabbix. it is sending only few alerts and most of the alerts are not sent. It just shows Error!. I am unable to check logs also. Please help.

var response,
    pl,
    params = JSON.parse(value),
    wurl = params.URL,
    clr = "00bdde",
    subj = params.Subject,
    msge = params.Message,
    pb = "Problem",
    rd = "Resolved",
    request = new CurlHttpRequest();
    
    if (subj.includes(pb)) {
      clr="de0000";
    };
    if (subj.includes(rd)) {
      clr="009600";
    };

    pl = '{"attachments": [{"color": "' + clr + '", "title": "' + subj + '", "text": "' + msge + '"}] }';
    Zabbix.Log(4, '[ Slack Webhook ] Sending request: ');

    request.AddHeader('Content-Type: application/json');
    response = request.Post(wurl, pl);

    return 'OK';