@@ -81,11 +81,6 @@ sub check_options {
8181 $self -> {output }-> option_exit();
8282 }
8383
84- if ($self -> {teams_workflow_params } eq ' ' ) {
85- $self -> {output }-> add_option_msg(short_msg => ' Need to specify the --teams-workflow-params option.' );
86- $self -> {output }-> option_exit();
87- }
88-
8984 $self -> {http }-> set_options(%{$self -> {option_results }}, hostname => ' dummy' );
9085
9186 return 0;
@@ -111,9 +106,14 @@ sub teams_post_notification {
111106 my ($self , %options ) = @_ ;
112107
113108 my $encoded_data = JSON::XS-> new-> utf8-> encode($options {json_request });
114- my $full_url = $self -> {teams_workflow } . ' ?' ;
115- foreach (split (/ ,/ , $self -> {teams_workflow_params })) {
116- $full_url .= $_ . ' &' ;
109+ my $full_url = $self -> {teams_workflow };
110+
111+ if (defined ($self -> {teams_workflow_params }) && $self -> {teams_workflow_params } ne ' ' ) {
112+ $full_url .= ' ?' ;
113+
114+ foreach (split (/ ,/ , $self -> {teams_workflow_params })) {
115+ $full_url .= $_ . ' &' ;
116+ }
117117 }
118118
119119 $full_url =~ s / &$// ;
@@ -145,10 +145,12 @@ Microsoft Office 365 Teams Workflows API
145145=item B<--teams-workflow >
146146
147147Define the Workflow URL (required).
148+ Example:
149+ perl centreon_plugins.pl --plugin=notification::microsoft::office365::teams::plugin --mode=alert --custommode=workflowapi --teams-workflow='https://url.logic.azure.com:443/workflows/workflowId/triggers/manual/paths/invoke?api-version=2023-11-01&sp=%2Ftriggers%2Fmanual%2Frunsv=1.0&sig=sigId'
148150
149151=item B<--teams-workflow-params >
150152
151- Define the Workflow URL parameters separated by commas (required).
153+ Define the Workflow URL parameters separated by commas (required). This option should be used if "&" is in the Centreon Engine illegal characters list.
152154Example:
153155perl centreon_plugins.pl --plugin=notification::microsoft::office365::teams::plugin --mode=alert --custommode=workflowapi --teams-workflow='https://url.logic.azure.com:443/workflows/workflowId/triggers/manual/paths/invoke' --teams-workflow-params='api-version=2023-11-01,sp=%2Ftriggers%2Fmanual%2Frunsv=1.0,sig=sigId'
154156
0 commit comments