Skip to content

Commit

Permalink
✨ Add welcome mesage
Browse files Browse the repository at this point in the history
  • Loading branch information
henryhamon committed May 4, 2024
1 parent 6797f62 commit 4bec490
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/dc/irisMediCopilot/interop/dtl/NewUser.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Class dc.irisMediCopilot.interop.dtl.NewUser Extends Ens.DataTransform [ DependsOn = (Telegram.JSONContainer, Telegram.Request) ]
{

ClassMethod Transform(source As Telegram.JSONContainer, ByRef target As Telegram.Request) As %Status
{
Set tSC = $$$OK
Try {

Set target = ##class(Telegram.Request).%New()

Set data = {
"chat_id": (source.Data.message.chat.id),
"protect_content": 1
}

Set target.Method = "sendMessage"
Set data."text" = "Welcome "_source.Data.message."new_chat_participant"."first_name"_ " to Iris MediCoPilot"

Set target.Data = data

} Catch ex {
Set tSC = ex.AsStatus()
}
Return tSC
}

}
3 changes: 3 additions & 0 deletions src/dc/irisMediCopilot/interop/rule/FilterMessageRule.cls
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ XData RuleDefinition [ XMLNamespace = "http://www.intersystems.com/rule" ]
<when condition="(GetJSONValue(Document.Data.message,&quot;voice&quot;))!=&quot;&quot;" comment="">
<send transform="dc.irisMediCopilot.interop.dtl.VoiceTransform" target="TelegramVoice.Process"></send>
</when>
<when condition="(GetJSONValue(Document.Data.message,&quot;text&quot;))=&quot;/start&quot;" comment="">
<send transform="dc.irisMediCopilot.interop.dtl.NewUser" target="Telegram.BusinessOperation"></send>
</when>
<when condition="(GetJSONValue(Document.Data.message,&quot;text&quot;))!=&quot;&quot;" comment="">
<send transform="dc.irisMediCopilot.interop.dtl.MessageTransform" target="Telegram.BusinessOperation"></send>
</when>
Expand Down

0 comments on commit 4bec490

Please sign in to comment.