# Wondering how others check for params in command

**URL:** <https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688>\
**Category:** InsightConnect\
**Created:** [April 29, 2025, 7:14pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688 "2025-04-29T19:14:11Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/sean/32/2224_2.png) [@Sean](https://discuss.rapid7.com/u/Sean)\
**Post date:** [April 29, 2025, 7:14pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/1 "2025-04-29T19:14:11Z")

</div>

I am updating a workflow that I built a little while ago that lets some people reset passwords in AD. Our process has been updated that for some instances we have to notify a person’s manager when we reset their password.

Our workflow is kicked off via MS Teams using

> !reset-password \<sam/upn\>

I plan on adding two parameters: -notify and -ticket

I know I could just require having them in a specific order, but I know some people will keep forgetting.

So, question is, instead of looping the words property through a loop and checking each item value to see if these two values exist, is there a better way to determine if those two parameters were included in the trigger? Should I just dump the value of the trigger.words to an artifact and then run the artifact through a regex action?

The end goal would look something like this:

> !reset-password -notify -ticket \<ticket#\> \<sam/upn\>

or

> !reset-password \<sam/upn\> -notify -ticket \<ticket#\>

This is the same workflow that is used for account clean up so the list could be rather long, which is why I want to avoid having to loop through an entire array.

Thanks!  
Sean

\*Edit: added what the command would look like with the parameters sent via Teams

---

<div class="post-metadata">

**Author:** ![Eric-Wilson](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/eric-wilson/32/2531_2.png) [@Eric-Wilson](https://discuss.rapid7.com/u/Eric-Wilson)\
**Post date:** [April 29, 2025, 8:42pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/2 "2025-04-29T20:42:50Z")

</div>

It’s a good idea for users to follow the same format for executing the workflow each time and also to notify them when parameters are in the wrong order. It would then be best to extract those using the pattern match step using the variable feature. It would then look something like this:

Input: message  
Pattern: `!reset-password -notify {{notify: /.*/}} -ticket {{ticket:/.*/}}`

Docs: [Use a Pattern Match Step | InsightConnect Documentation](https://docs.rapid7.com/insightconnect/pattern-match-step/)

---

<div class="post-metadata">

**Author:** ![brandon\_mcclure](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/brandon_mcclure/32/182_2.png) [@brandon\_mcclure](https://discuss.rapid7.com/u/brandon_mcclure)\
**Post date:** [April 30, 2025, 2:18pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/3 "2025-04-30T14:18:28Z")

</div>

I do this all the time, but with pattern matching.  
My initial Regex is (?i)^!reset-?password  
I then have a pattern match of  
-t(icket)?(=|:|\s)“?{{TicketNumber:/[^\s”]+/}}

On catch, make sure you run the remove html tags from the returned string, Teams inserts these when you copy/paste and will break your ^

---

<div class="post-metadata">

**Author:** ![Sean](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/sean/32/2224_2.png) [@Sean](https://discuss.rapid7.com/u/Sean)\
**Post date:** [April 30, 2025, 2:36pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/4 "2025-04-30T14:36:37Z")

</div>

I was just reading your reply to another thread that you mentioned the same thing but for trigger check.

What are you using to stop the HTML out? I have not found an action that will do that.

---

<div class="post-metadata">

**Author:** ![Eric-Wilson](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/eric-wilson/32/2531_2.png) [@Eric-Wilson](https://discuss.rapid7.com/u/Eric-Wilson)\
**Post date:** [April 30, 2025, 2:43pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/5 "2025-04-30T14:43:51Z")

</div>

The problem generally arrises when users copy/paste text into the message in Teams. You can try having them “paste without formatting.” To paste text without formatting on both Mac and Windows, use Ctrl + Shift + V on Windows and Cmd + Shift + V on Mac. Otherwise, you can use the HTML plugin to strip the HTML from the text before running the message through pattern match.

---

<div class="post-metadata">

**Author:** ![brandon\_mcclure](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/brandon_mcclure/32/182_2.png) [@brandon\_mcclure](https://discuss.rapid7.com/u/brandon_mcclure)\
**Post date:** [April 30, 2025, 2:50pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/6 "2025-04-30T14:50:27Z")

</div>

I cannot trust people to paste correctly so I use the HTML plugin like suggested, this will slow down the workflow slightly but saves you from people reaching out saying that isn’t working. I also try to account for the different ways that people might enter the argument to avoid human error

---

<div class="post-metadata">

**Author:** ![brandon\_mcclure](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/brandon_mcclure/32/182_2.png) [@brandon\_mcclure](https://discuss.rapid7.com/u/brandon_mcclure)\
**Post date:** [April 30, 2025, 2:54pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/7 "2025-04-30T14:54:55Z")

</div>

If you want to control how people enter the command and give them a GUI like interface, look into adaptive cards. I have that trigger on the ICON username, it presents a simple GUI where they copy and paste into that form, it then formats the command correctly. This allows you to manually enter the command (e.g. have another Workflow post a command for you, we use this when a Workflow wants to automatically reset a password, instead of the Workflow calling it, it sends the Teams command) or a user can use the GUI

---

<div class="post-metadata">

**Author:** ![Sean](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/sean/32/2224_2.png) [@Sean](https://discuss.rapid7.com/u/Sean)\
**Post date:** [April 30, 2025, 3:48pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/8 "2025-04-30T15:48:35Z")

</div>

What? I have never heard of this feature. My primary function is not automation, it is more like, “do it when you never, i mean have, time.”

So they would log into InsightConnect to run the commands? I will look into this. Thank you!

---

<div class="post-metadata">

**Author:** ![Sean](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/sean/32/2224_2.png) [@Sean](https://discuss.rapid7.com/u/Sean)\
**Post date:** [April 30, 2025, 3:49pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/9 "2025-04-30T15:49:30Z")

</div>

Thank you for the input on the HTML plugin. I will look into this! I did not see this response.

---

<div class="post-metadata">

**Author:** ![Sean](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/sean/32/2224_2.png) [@Sean](https://discuss.rapid7.com/u/Sean)\
**Post date:** [April 30, 2025, 4:00pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/10 "2025-04-30T16:00:26Z")

</div>

I am trying to do that right now and it sort of feels like an effort in futility. Every time I think I have it figured out, they figure out something new and novel to cause a problem. lol.

---

<div class="post-metadata">

**Author:** ![brandon\_mcclure](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/brandon_mcclure/32/182_2.png) [@brandon\_mcclure](https://discuss.rapid7.com/u/brandon_mcclure)\
**Post date:** [April 30, 2025, 4:58pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/11 "2025-04-30T16:58:36Z")

</div>

This is not an ICON feature, it is a Teams feature. But I use it because people cannot remember the different commands  
[https://learn.microsoft.com/en-us/power-automate/overview-adaptive-cards](https://learn.microsoft.com/en-us/power-automate/overview-adaptive-cards)

---

<div class="post-metadata">

**Author:** ![Darrick\_Hall](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/darrick_hall/32/2530_2.png) [@Darrick\_Hall](https://discuss.rapid7.com/u/Darrick_Hall)\
**Post date:** [April 30, 2025, 5:16pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/12 "2025-04-30T17:16:47Z")

</div>

I had to make assumptions on your user names and your ticket format, but assuming your usernames do not contain numbers, and your tickets do contain numbers, with JQ you can make your workflow work. I tested with the following scenarios and everyone of them works.

!reset-password -notify -ticket 1351351346 darrick  
!reset-password -notify darrick -ticket 1351351346  
!reset-password -ticket 1351351346 -notify darrick  
!reset-password -ticket 1351351346 darrick -notify  
!reset-password darrick -notify -ticket 1351351346  
!reset-password darrick -ticket 1351351346 -notify

!reset-password -ticket 1351351346 darrick  
!reset-password -ticket 1351351346 darrick  
!reset-password darrick -ticket 1351351346

Below is a workflow you can import and test it out if you want.

The JQ statement looks like this:

.message.words as $words  
| {  
notify: ($words | index(“-notify”) | if . == null then false else true end),  
ticket: (  
$words  
| map(select(type == “string” and test(“\d”)))  
| .[0]  
),  
user: (  
$words  
| map(select(  
type == “string”  
and (test(“^!”) | not)  
and (test(“^-[a-zA-Z]+$”) | not)  
and (test(“\d”) | not)  
))  
| .[0]  
)  
}

I am returning a true or a false if the notify flag was sent through. You can just leverage a decision on that variable.

 ![Screenshot 2025-04-30 at 11.16.20 AM](https://forum-uploads-hub-prod-1-us-east-1-rapid7-com.s3.dualstack.us-east-1.amazonaws.com/original/2X/7/7bd86670269ce37dea66197809549b1d7c024c0d.png)

[Handle Non Standard User Input.icon](https://discuss.rapid7.com/uploads/short-url/caYMfuguephpAhjG4clt0qlptW.icon) (33.4 KB)

---

<div class="post-metadata">

**Author:** ![Sean](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/sean/32/2224_2.png) [@Sean](https://discuss.rapid7.com/u/Sean)\
**Post date:** [May 28, 2025, 7:03pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/13 "2025-05-28T19:03:05Z")

</div>

I am trying to learn how to use the JQ action, so far I am not having much success with it. Thanks for the information, I will import the workflow and use it as an example.

---

<div class="post-metadata">

**Author:** ![Sean](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/sean/32/2224_2.png) [@Sean](https://discuss.rapid7.com/u/Sean)\
**Post date:** [May 28, 2025, 7:07pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/14 "2025-05-28T19:07:51Z")

</div>

> [@Eric-Wilson](#):
>
> Input: message  
> Pattern: `!reset-password -notify {{notify: /.*/}} -ticket {{ticket:/.*/}}`

Hopefully these are not stupid question, but when you have the import as message. Is the input message the teams trigger property of `{{["Trigger-teams-reset-password"].[message].[body].[content]}}`?

\*edit: removed an actual dumb question as after posting my reply I remembered that the documentation stated that is how you create a variable for the pattern match step.

---

<div class="post-metadata">

**Author:** ![Darrick\_Hall](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/darrick_hall/32/2530_2.png) [@Darrick\_Hall](https://discuss.rapid7.com/u/Darrick_Hall)\
**Post date:** [May 28, 2025, 10:07pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/15 "2025-05-28T22:07:47Z")

</div>

You can use a website like this: [https://www.devtoolsdaily.com/jq\_playground/](https://www.devtoolsdaily.com/jq_playground/)

Just grab some random json payload and test it out. First get it working in there, and then try the JQ plugin in InsightConnect.

---

<div class="post-metadata">

**Author:** ![Darrick\_Hall](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/darrick_hall/32/2530_2.png) [@Darrick\_Hall](https://discuss.rapid7.com/u/Darrick_Hall)\
**Post date:** [May 28, 2025, 10:15pm UTC](https://discuss.rapid7.com/t/wondering-how-others-check-for-params-in-command/50688/16 "2025-05-28T22:15:41Z")

</div>

Here are a few resources for you @Sean

> [@Reformatting data with the jq Plugin](https://discuss.rapid7.com/t/reformatting-data-with-the-jq-plugin/4551):
>
> jq is a tool for searching json data and reformatting it into various output formats. It can be used to filter, reformat, and extract data from within a json object. Depending on how you structure your query, it can output valid json or simple text. jq is someplace between a query language and a template language - it incorporates elements of both with templated output but also with select-style filtering. Perhaps an example is the best place to get started: Sometimes we just need the same …

> [@Out of work hours activity detection](https://discuss.rapid7.com/t/out-of-work-hours-activity-detection/46817/4):
>
> I am very sorry about the late reply. So the solution I would propose would be to use the JQ plugin. JQ is Java Query, and recently I have found it to be quite useful. You can remove large loops, you can transform data. I believe you could probably remove your python step as well and match all false and False as one like value if you were to perform some trial and error. The JQ plugin is looking for an object as input. This is going on the assumption that your array you want to loop through is…
