-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7b6b91
commit 4756c5d
Showing
6 changed files
with
92 additions
and
129 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
send_message_to_user_in_microsoft_teams/flowpipe.fpvars.example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
team_id="Team_ID" |
2 changes: 0 additions & 2 deletions
2
send_message_to_user_in_microsoft_teams/flowpipe.pvars.example
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
mod "send_message_to_user_in_microsoft_teams" { | ||
title = "Send mail to user" | ||
description = "Send a message to specific Teams user." | ||
title = "Send Message to Teams User" | ||
description = "Send an email to user in Microsoft Teams." | ||
|
||
require { | ||
mod "github.com/turbot/flowpipe-mod-teams" { | ||
version = "v0.0.1-rc.12" | ||
version = "v0.0.1-rc.13" | ||
args = { | ||
access_token = var.access_token | ||
team_id = var.team_id | ||
team_id = var.team_id | ||
} | ||
} | ||
} | ||
} | ||
} |
116 changes: 0 additions & 116 deletions
116
send_message_to_user_in_microsoft_teams/send_email_to_user_in_teams.fp
This file was deleted.
Oops, something went wrong.
86 changes: 86 additions & 0 deletions
86
send_message_to_user_in_microsoft_teams/send_message_to_user_in_microsoft_teams.fp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
pipeline "send_email_to_teams_user" { | ||
title = "Send Email Message to Specific Teams User" | ||
description = "Send an email to specific Team user and communicate to Team with a an update messge." | ||
|
||
param "to_email" { | ||
type = string | ||
description = "The email-id of the primary receipient." | ||
} | ||
|
||
param "subject" { | ||
type = string | ||
description = "The subject of the email." | ||
} | ||
|
||
param "content" { | ||
type = string | ||
description = "The content of the email." | ||
} | ||
|
||
param "team_id" { | ||
type = string | ||
description = "The unique identifier of the team." | ||
default = var.team_id | ||
} | ||
|
||
param "channel_id" { | ||
type = string | ||
description = "The channel's unique identifier." | ||
optional = true | ||
} | ||
|
||
# Check if the user exists in Teams by to_email | ||
step "pipeline" "get_user_by_email" { | ||
pipeline = teams.pipeline.get_user_by_email | ||
|
||
args = { | ||
user_email = param.to_email | ||
} | ||
|
||
# Exit pipeline, when the requested user is unavailable. | ||
throw { | ||
if = result.output.status_code == 404 | ||
message = "#### The requested user email is not found. Exiting the pipeline ####." | ||
} | ||
} | ||
|
||
# Get all members of the team | ||
step "pipeline" "list_team_members" { | ||
depends_on = [step.pipeline.get_user_by_email] | ||
|
||
pipeline = teams.pipeline.list_team_members | ||
|
||
args = { | ||
team_id = param.team_id | ||
} | ||
} | ||
|
||
# Send email is the user is a member of the team | ||
step "pipeline" "send_mail" { | ||
depends_on = [step.pipeline.list_team_members] | ||
for_each = { for user in step.pipeline.list_team_members.output.members : user.userId => user } | ||
if = step.pipeline.get_user_by_email.output.user.id == each.key | ||
|
||
pipeline = teams.pipeline.send_mail | ||
|
||
args = { | ||
to_email = ["${step.pipeline.get_user_by_email.output.user.userPrincipalName}"] | ||
subject = param.subject | ||
content = param.content | ||
} | ||
} | ||
|
||
# Update specific team > channel with a message that mail is communicated | ||
step "pipeline" "send_channel_message" { | ||
depends_on = [step.pipeline.send_mail] | ||
if = param.channel_id != null | ||
|
||
pipeline = teams.pipeline.send_channel_message | ||
|
||
args = { | ||
team_id = param.team_id | ||
channel_id = param.channel_id | ||
message = "Mail sent to ${step.pipeline.get_user_by_email.output.user.displayName}(${step.pipeline.get_user_by_email.output.user.userPrincipalName})." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters