Skip to content

Commit

Permalink
adding MessageAnalysisCompletedEvent to EG SDk (Azure#28912)
Browse files Browse the repository at this point in the history
* adding MessageAnalysisCompletedEvent to EG SDk

* adding event to communication tps

* generating spec

* generating spec

* removing sentiment

* removing sentiment

* removing sentiment

* more changes

* addressing comments

* updating the analysis events

* updating the analysis events

* updating the analysis events

* Update specification/eventgrid/data-plane/Microsoft.Communication/stable/2018-01-01/AzureCommunicationServices.json

* tsp format

---------

Co-authored-by: JoshLove-msft <[email protected]>
Co-authored-by: l0lawrence <[email protected]>
  • Loading branch information
3 people authored Jul 10, 2024
1 parent 1b0e82d commit 0117e47
Show file tree
Hide file tree
Showing 10 changed files with 253 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,25 @@ model AcsMessageReceivedEventData extends AcsMessageEventData {
interactive: AcsMessageInteractiveContent;
}

/** Schema of the Data property of an EventGridEvent for a Microsoft.Communication.AdvancedMessageAnalysisCompleted event. */
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "Maintain compatibility with existing models."
model AcsMessageAnalysisCompletedEventData extends AcsMessageEventData {
/** The original message received. */
originalMessage: string;

/** The analysed message channel kind. */
channelKind: AcsMessageChannelKind;

/** The intent of the analysed message. */
intentAnalysis: string;

/** List of key phrases extracted. */
extractedKeyPhrases: string[];

/** The analysed message language detection. */
languageDetection: AcsMessageLanguageDetection;
}

/** Message Media Content */
model AcsMessageMediaContent {
/** The MIME type of the file this media represents */
Expand Down Expand Up @@ -1250,6 +1269,18 @@ model AcsMessageChannelEventError {
channelMessage?: string;
}

/** Message Analysis Language Detection */
model AcsMessageLanguageDetection {
/** The language of the message. */
language: string;

/** The confidence score of the language detected. */
confidenceScore: float64;

/** The translation of the message. */
translation: string;
}

/** Interactive reply kind */
union AcsInteractiveReplyKind {
/** Messaged interactive reply type is ButtonReply */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,3 +511,9 @@ using Azure.ClientGenerator.Core;
@@access(Microsoft.EventGrid.SystemEvents.CommunicationCloudEnvironmentModel,
Access.public
);
@@usage(Microsoft.EventGrid.SystemEvents.AcsMessageAnalysisCompletedEventData,
Usage.output
);
@@access(Microsoft.EventGrid.SystemEvents.AcsMessageAnalysisCompletedEventData,
Access.public
);
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,70 @@
}
}
},
"AcsMessageAnalysisCompletedEventData": {
"description": "Schema of the Data property of an EventGridEvent for a Microsoft.Communication.AdvancedMessageAnalysisCompleted event.",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/AcsMessageEventData"
}
],
"properties": {
"originalMessage": {
"description": "The original message received",
"type": "string"
},
"channelType": {
"description": "The Analysed message channel Kind",
"type": "string",
"x-ms-client-name": "channelKind",
"enum": [
"whatsapp"
],
"x-ms-enum": {
"name": "AcsMessageChannelKind",
"modelAsString": true,
"values": [
{
"value": "whatsapp",
"description": "Updated message channel type is Whatsapp"
}
]
}
},
"intentAnalysis": {
"description": "The intent of the analysed message",
"type": "string"
},
"extractedKeyPhrases": {
"description": "List of key phrases extracted",
"type": "array",
"items": {
"type": "string"
}
},
"languageDetection": {
"description": "The analysed message language detection",
"$ref": "#/definitions/AcsMessageLanguageDetection",
"type": "object"
}
},
"required": [
"originalMessage",
"channelType",
"intentAnalysis",
"extractedKeyPhrases",
"languageDetection"
],
"x-ms-examples": {
"snapshotCreatedCloudEventsSchema": {
"$ref": "./examples/cloud-events-schema/advanced_message_analysis_completed.json"
},
"snapshotCreatedEventGridSchema": {
"$ref": "./examples/event-grid-schema/advanced_message_analysis_completed.json"
}
}
},
"AcsMessageEventData": {
"description": "Schema of common properties of all chat thread events",
"type": "object",
Expand Down Expand Up @@ -2338,6 +2402,30 @@
"type": "string"
}
}
},
"AcsMessageLanguageDetection": {
"description": "Message Analysis Language Detection",
"type": "object",
"properties": {
"language": {
"description": "The language of the message",
"type": "string"
},
"confidenceScore": {
"description": "The confidence score of the language detected",
"type": "number",
"format": "double"
},
"translation": {
"description": "The translation of the message",
"type": "string"
}
},
"required": [
"language",
"confidenceScore",
"translation"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"id": "daa5be3b-2652-4eb1-b330-689aaf6606d7",
"source": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "advanceMessageAnalysis/sender/{sender@id}/recipient/{recipient@id}",
"data": {
"originalMessage": "Yesterday I talked to sara parker, she said that my package did not arrive in Kalamazoo, but was sent to lafeyette instead. So said that I should get in touch with herb and he will help me. My order number is #567890. Can you please help me track my package? I'm really frustrated",
"channelType": "whatsapp",
"from": "{sender@id}",
"to": "{recipient@id}",
"languageDetection": {
"language": "English",
"confidenceScore": 0.99,
"translation": "Yesterday I talked to sara parker, she said that my package did not arrive in Kalamazoo, but was sent to lafeyette instead. So said that I should get in touch with herb and he will help me. My order number is #567890. Can you please help me track my package? I'm really frustrated"
},
"intentAnalysis": "The customer is contacting customer service to request assistance with tracking their package.",
"keyphraseExtraction": [
"Sara Parker",
"package",
"Kalamazoo"
]
},
"type": "Microsoft.Communication.AdvancedMessageAnalysisCompleted",
"specVersion": "1.0",
"time": "2023-02-01T01:54:35.567235Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"messageId": "d59f9468-0a5c-4022-8200-d7bf6fb78bc5",
"status": "delivered",
"channelType": "whatsapp",
"from": "12375679879",
"to": "1345679879",
"from": "{recipient@id}",
"to": "{sender@id}",
"receivedTimestamp": "2024-03-22T17:06:11.1980225+00:00",
"error": {
"channelCode": "channelCode",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "4611364c-08fb-4a8a-a8b5-7e40203285d3",
"source": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "advancedMessage/sender/18334411877/recipient/be57b49d-5cd4-4f96-9a6b-4af41bc9fdfb",
"subject": "advancedMessage/sender/{sender@id}/recipient/{recipient@id}",
"data": {
"content": "Come on guys, lets go for lunch together.",
"channelType": "whatsapp",
Expand All @@ -12,7 +12,7 @@
"caption": "caption"
},
"context": {
"from": "1234578988",
"from": "{recipient@id}",
"id": "messageId"
},
"button": {
Expand All @@ -26,8 +26,8 @@
"title": "button reply"
}
},
"from": "12375679879",
"to": "1345679879",
"from": "{recipient@id}",
"to": "{sender@id}",
"receivedTimestamp": "2024-03-22T17:06:11.2610383+00:00",
"error": {
"channelCode": "channelCode",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"id": "daa5be3b-2652-4eb1-b330-689aaf6606d7",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "advanceMessageAnalysis/sender/{sender@id}/recipient/{recipient@id}",
"data": {
"originalMessage": "Yesterday I talked to sara parker, she said that my package did not arrive in Kalamazoo, but was sent to lafeyette instead. So said that I should get in touch with herb and he will help me. My order number is #567890. Can you please help me track my package? I'm really frustrated",
"channelType": "whatsapp",
"from": "{sender@id}",
"to": "{recipient@id}",
"languageDetection": {
"language": "English",
"confidenceScore": 0.99,
"translation": "Yesterday I talked to sara parker, she said that my package did not arrive in Kalamazoo, but was sent to lafeyette instead. So said that I should get in touch with herb and he will help me. My order number is #567890. Can you please help me track my package? I'm really frustrated"
},
"intentAnalysis": "The customer is contacting customer service to request assistance with tracking their package.",
"keyphraseExtraction": [
"Sara Parker",
"package",
"Kalamazoo"
]
},
"eventType": "Microsoft.Communication.AdvancedMessageAnalysisCompleted",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2023-02-01T01:54:35.567235Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"messageId": "d59f9468-0a5c-4022-8200-d7bf6fb78bc5",
"status": "delivered",
"channelType": "whatsapp",
"from": "12375679879",
"to": "1345679879",
"from": "{sender@id}",
"to": "{recipient@id}",
"receivedTimestamp": "2024-03-22T17:06:11.1980225+00:00",
"error": {
"channelCode": "channelCode",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "4611364c-08fb-4a8a-a8b5-7e40203285d3",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "advancedMessage/sender/18334411877/recipient/be57b49d-5cd4-4f96-9a6b-4af41bc9fdfb",
"subject": "advancedMessage/sender/{sender@id}/recipient/{recipient@id}",
"data": {
"content": "Come on guys, lets go for lunch together.",
"channelType": "whatsapp",
Expand All @@ -12,7 +12,7 @@
"caption": "caption"
},
"context": {
"from": "1234578988",
"from": "{sender@id}",
"id": "messageId"
},
"button": {
Expand All @@ -26,8 +26,8 @@
"title": "button reply"
}
},
"from": "12375679879",
"to": "1345679879",
"from": "{sender@id}",
"to": "{recipient@id}",
"receivedTimestamp": "2024-03-22T17:06:11.2610383+00:00",
"error": {
"channelCode": "channelCode",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,47 @@
]
}
},
"AcsMessageAnalysisCompletedEventData": {
"type": "object",
"description": "Schema of the Data property of an EventGridEvent for a Microsoft.Communication.AdvancedMessageAnalysisCompleted event.",
"properties": {
"originalMessage": {
"type": "string",
"description": "The original message received."
},
"channelKind": {
"$ref": "#/definitions/AcsMessageChannelKind",
"description": "The analysed message channel kind."
},
"intentAnalysis": {
"type": "string",
"description": "The intent of the analysed message."
},
"extractedKeyPhrases": {
"type": "array",
"description": "List of key phrases extracted.",
"items": {
"type": "string"
}
},
"languageDetection": {
"$ref": "#/definitions/AcsMessageLanguageDetection",
"description": "The analysed message language detection."
}
},
"required": [
"originalMessage",
"channelKind",
"intentAnalysis",
"extractedKeyPhrases",
"languageDetection"
],
"allOf": [
{
"$ref": "#/definitions/AcsMessageEventData"
}
]
},
"AcsMessageButtonContent": {
"type": "object",
"description": "Message Button Content",
Expand Down Expand Up @@ -1145,6 +1186,30 @@
}
}
},
"AcsMessageLanguageDetection": {
"type": "object",
"description": "Message Analysis Language Detection",
"properties": {
"language": {
"type": "string",
"description": "The language of the message."
},
"confidenceScore": {
"type": "number",
"format": "double",
"description": "The confidence score of the language detected."
},
"translation": {
"type": "string",
"description": "The translation of the message."
}
},
"required": [
"language",
"confidenceScore",
"translation"
]
},
"AcsMessageMediaContent": {
"type": "object",
"description": "Message Media Content",
Expand Down

0 comments on commit 0117e47

Please sign in to comment.