Summary

The updateEmailAction() mutation modifies an existing email action in a LogScale repository or view. Use it to change the recipient list, subject template, body template, proxy setting, CSV attachment option, or labels of an action associated with alerts or scheduled searches. The mutation applies full-replace semantics: all required fields must be supplied on every call, even when their values are unchanged.

Recipients can be static email addresses or message template expressions that resolve field values at trigger time, for example {field:email}. Each unique resolved address receives a separate notification. When using template expressions, scope the triggering query so that each recipient receives only events relevant to them.

Syntax

graphql
updateEmailAction(
      input: UpdateEmailAction!
   ): EmailAction!

The mutation accepts a single required input argument of type UpdateEmailAction!. Provide the existing action identifier, the view or repository name, the action name, the complete recipient list, and the proxy setting. These fields are required on every call. The subject template, body template, CSV attachment flag, and labels are optional.

The mutation returns a non-null EmailAction! object reflecting the updated state of the action. Use the returned fields to confirm the update was applied correctly.

Input parameters

The UpdateEmailAction! input type uses full-replace semantics: supply all required fields on every call, even when values are unchanged. The id field identifies the action to modify; retrieve it from the repository() query in the Related section. The viewName and name fields set the repository context and the action's display name; you can change name on update. The recipients list accepts static email addresses or message template expressions using {field:fieldname} syntax; each unique resolved address receives a separate notification. Set useProxy to true to route outgoing email through the HTTP proxy configured for the LogScale instance.

The optional subjectTemplate and bodyTemplate fields accept {field:fieldname} syntax to interpolate event field values at trigger time. Set either to null to use the system default template. Set attachCsvFile to true to attach a CSV of matching events to the notification. The labels field accepts a list of strings for organizing and filtering actions. The following table describes each input field in the UpdateEmailAction! type:

Table: UpdateEmailAction Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
attachCsvBoolean  Long-Term Whether the result set should be be attached as a CSV file.
bodyTemplateString  Long-Term The body of the email. This can be templated with values from the result.
idStringyes Long-Term The unique identifier of the action.
labelsStringyes Long-Term A set of labels by which to categorize the action.
nameStringyes Long-Term The name of the action.
recipientsStringyes Long-Term List of email addresses where to send an email.
subjectTemplateString  Long-Term Subject of the email. Can be templated with values from the result.
useProxyBooleanyes Long-Term Defines whether the action should use the configured proxy to make web requests.
viewNameStringyes Long-Term The name of the view of the action.

Example

Raw
graphql
mutation {
  updateEmailAction( input:
     { viewName: "humio",
       name: "WakeUp",
       id: "abc123"
       recipients: ["bob@company.com", "ted@company.com" ],
       useProxy: false
    } 
  )
  { name }
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  updateEmailAction( input:
     { viewName: \"humio\",
       name: \"WakeUp\",
       id: \"abc123\"
       recipients: [\"bob@company.com\", \"ted@company.com\" ],
       useProxy: false
    } 
  )
  { name }
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  updateEmailAction( input:
     { viewName: \"humio\",
       name: \"WakeUp\",
       id: \"abc123\"
       recipients: [\"bob@company.com\", \"ted@company.com\" ],
       useProxy: false
    } 
  )
  { name }
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  updateEmailAction( input: ^
     { viewName: \"humio\", ^
       name: \"WakeUp\", ^
       id: \"abc123\" ^
       recipients: [\"bob@company.com\", \"ted@company.com\" ], ^
       useProxy: false ^
    }  ^
  ) ^
  { name } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  updateEmailAction( input:
     { viewName: \"humio\",
       name: \"WakeUp\",
       id: \"abc123\"
       recipients: [\"bob@company.com\", \"ted@company.com\" ],
       useProxy: false
    } 
  )
  { name }
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  updateEmailAction( input:
     { viewName: \"humio\",
       name: \"WakeUp\",
       id: \"abc123\"
       recipients: [\"bob@company.com\", \"ted@company.com\" ],
       useProxy: false
    } 
  )
  { name }
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  updateEmailAction( input:
     { viewName: \"humio\",
       name: \"WakeUp\",
       id: \"abc123\"
       recipients: [\"bob@company.com\", \"ted@company.com\" ],
       useProxy: false
    } 
  )
  { name }
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  updateEmailAction( input:
     { viewName: \"humio\",
       name: \"WakeUp\",
       id: \"abc123\"
       recipients: [\"bob@company.com\", \"ted@company.com\" ],
       useProxy: false
    } 
  )
  { name }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "updateEmailAction": {
      "name": "WakeUp"
    }
  }
}

Returned values

The mutation returns a non-null EmailAction! object reflecting the updated state of the action. The returned fields include the action identifier, name, recipient list, subject and body templates, proxy setting, CSV attachment flag, labels, and audit timestamps. Use these values to confirm the update was applied correctly. The id value is unchanged after an update. Use it to reference the action in subsequent calls, such as deleteActionV2() or testEmailAction().

Table: EmailAction Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
allowedActions[AssetAction]yes Short-Term The allowed asset actions. See AssetAction . This is a preview feature. Changes may occur.
attachCsvbooleanyes Long-Term Whether the result set should be attached as a CSV file.
bodyTemplatestring  Long-Term Body of the email. Can be templated with values from the result.
createdInfoAssetCommitMetadata  Long-Term Metadata related to the creation of the action. See AssetCommitMetadata.
displayNamestringyes Long-Term The display name of the action.
idstringyes Long-Term The unique identifier of the action.
isAllowedToRunbooleanyes Long-Term False if this type of action is disabled because of a security policy.
labels[string]  Preview The labels associated with the action, if any.
modifiedInfoAssetCommitMetadata  Long-Term Metadata related to the latest modification of the action. See AssetCommitMetadata.
namestringyes Long-Term The name of the action.
packagePackageInstallation  Long-Term The package which the action is part. See PackageInstallation.
packageIdVersionedPackageSpecifier  Long-Term The package version. VersionedPackageSpecifier is a scalar.
recipients[string]yes Long-Term List of email addresses to send an email.
requiresOrganizationOwnedQueriesPermissionToEditbooleanyes Long-Term True if this action is used by triggers, where the query is run by the organization. If true, then the OrganizationOwnedQueries permission is required to edit the action.
resourcestringyes Short-Term The resource identifier for the action.
subjectTemplatestring  Long-Term Subject of the email. Can be templated with values from the result.
useProxybooleanyes Long-Term Defines whether the action should use the configured proxy to make web requests.
yamlTemplateYAMLyes Long-Term A template that can be used to recreate the action. YAML is a scalar.