{ "swagger": "2.0", "info": { "title": "CommunicationMessagesClient", "description": "Azure Communication Messages Service", "version": "2023-08-24-preview" }, "paths": { "/messages/notifications/:send": { "post": { "tags": [ "Notifications" ], "operationId": "NotificationMessages_SendMessage", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [ { "$ref": "#/parameters/ApiVersionParameter" }, { "in": "body", "name": "body", "schema": { "$ref": "#/definitions/SendNotificationRequest" } } ], "responses": { "202": { "description": "Accepted", "schema": { "$ref": "#/definitions/SendMessageResult" } }, "default": { "description": "Communication Error Response", "schema": { "$ref": "#/definitions/CommunicationErrorResponse" }, "x-ms-error-response": true } }, "x-ms-examples": { "Send a notification message": { "$ref": "./examples/SendMessage.json" } } } }, "/messages/streams/{id}": { "get": { "tags": [ "Stream" ], "summary": "Download the Media payload from a User to Business message.", "operationId": "Stream_DownloadMedia", "produces": [ "application/json" ], "parameters": [ { "in": "path", "name": "id", "description": "The Media Identifier contained in the User to Business message event.", "required": true, "type": "string" }, { "$ref": "#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Success", "schema": { "format": "binary", "type": "string" } }, "default": { "description": "Communication Error Response", "schema": { "$ref": "#/definitions/CommunicationErrorResponse" }, "x-ms-error-response": true } }, "x-ms-examples": { "Download a media": { "$ref": "./examples/DownloadMedia.json" } } } }, "/messages/channels/{channelId}/templates": { "get": { "tags": [ "Template" ], "summary": "List all templates for given ACS channel", "operationId": "TemplateV2_List", "produces": [ "application/json" ], "parameters": [ { "in": "path", "name": "channelId", "required": true, "type": "string", "format": "uuid" }, { "in": "query", "name": "maxPageSize", "type": "integer", "format": "int32" }, { "$ref": "#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "OK - Returns the list of waTemplatesInternal.", "schema": { "$ref": "#/definitions/ListTemplatesResponse" } }, "default": { "description": "Communication Error Response", "schema": { "$ref": "#/definitions/CommunicationErrorResponse" }, "x-ms-error-response": true } }, "x-ms-pageable": { "nextLinkName": "nextLink", "itemName": "value" }, "x-ms-examples": { "Get a list of templates for a channel": { "$ref": "./examples/GetTemplates.json" } } } } }, "definitions": { "ChannelType": { "enum": [ "whatsApp" ], "type": "string", "x-ms-enum": { "name": "ChannelType", "modelAsString": true } }, "CommunicationError": { "$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationError" }, "CommunicationErrorResponse": { "$ref": "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse" }, "CommunicationMessageType": { "description": "The type of message. Supports text, image, template.", "enum": [ "text", "image", "template" ], "type": "string", "x-ms-enum": { "name": "CommunicationMessageType", "modelAsString": true } }, "ListTemplatesResponse": { "required": [ "value" ], "type": "object", "properties": { "value": { "description": "The collection of elements", "type": "array", "items": { "$ref": "#/definitions/TemplateResponse" } }, "nextLink": { "type": "string" } } }, "MessageReceipt": { "description": "Receipt of the sending one message.", "required": [ "messageId", "to" ], "type": "object", "properties": { "messageId": { "description": "The message id.", "type": "string" }, "to": { "description": "The native external platform user identifier of the recipient.", "type": "string" } } }, "MessageTemplate": { "description": "The template object used to create templates.", "required": [ "language", "name" ], "type": "object", "properties": { "name": { "description": "Name of the template.", "type": "string", "example": "appointment_update" }, "language": { "description": "The codes for the supported languages for templates.", "type": "string", "example": "en_US" }, "values": { "description": "The template values.", "type": "object", "additionalProperties": { "$ref": "#/definitions/MessageTemplateValue" } }, "bindings": { "$ref": "#/definitions/MessageTemplateBindings" } } }, "MessageTemplateBindings": { "description": "The binding object to link values to the template specific locations", "type": "object", "properties": { "whatsApp": { "$ref": "#/definitions/MessageTemplateBindingsWhatsApp" } } }, "MessageTemplateBindingsWhatsApp": { "description": "The template bindings for WhatsApp", "type": "object", "properties": { "header": { "type": "array", "items": { "$ref": "#/definitions/MessageTemplateBindingsWhatsAppComponent" } }, "body": { "type": "array", "items": { "$ref": "#/definitions/MessageTemplateBindingsWhatsAppComponent" } }, "footer": { "type": "array", "items": { "$ref": "#/definitions/MessageTemplateBindingsWhatsAppComponent" } }, "button": { "type": "array", "items": { "$ref": "#/definitions/MessageTemplateBindingsWhatsAppButton" } } } }, "MessageTemplateBindingsWhatsAppButton": { "description": "The template bindings component button for WhatsApp", "required": [ "refValue" ], "type": "object", "properties": { "subType": { "$ref": "#/definitions/MessageTemplateValueWhatsAppSubType" }, "refValue": { "description": "The reference to the value in the Microsoft.Azure.Communication.CrossPlatformMessages.Contract.Model.Notifications.V1.Requests.MessageTemplate.Values dictionary.", "type": "string", "example": "title" } } }, "MessageTemplateBindingsWhatsAppComponent": { "description": "The template bindings component for WhatsApp", "required": [ "refValue" ], "type": "object", "properties": { "refValue": { "description": "The reference to the value in the Microsoft.Azure.Communication.CrossPlatformMessages.Contract.Model.Notifications.V1.Requests.MessageTemplate.Values dictionary.", "type": "string", "example": "title" } } }, "MessageTemplateParameterLocation": { "description": "The message template's location value information.", "type": "object", "properties": { "name": { "description": "The [Optional] name of the location.", "type": "string", "example": "Microsoft" }, "address": { "description": "The [Optional] address of the location.", "type": "string", "example": "1 Microsoft Way, Redmond, WA 98052, USA" }, "latitude": { "format": "double", "description": "The latitude of the location.", "type": "number", "example": 47.639423 }, "longitude": { "format": "double", "description": "The longitude of the location.", "type": "number", "example": -122.12831 } } }, "MessageTemplateValue": { "description": "The class describes a parameter of a template.", "required": [ "kind" ], "type": "object", "properties": { "kind": { "$ref": "#/definitions/MessageTemplateValueKind" }, "text": { "$ref": "#/definitions/MessageTemplateValueText" }, "image": { "$ref": "#/definitions/MessageTemplateValueMedia" }, "document": { "$ref": "#/definitions/MessageTemplateValueMedia" }, "video": { "$ref": "#/definitions/MessageTemplateValueMedia" }, "location": { "$ref": "#/definitions/MessageTemplateParameterLocation" }, "quickAction": { "$ref": "#/definitions/MessageTemplateValueQuickAction" } } }, "MessageTemplateValueKind": { "description": "The template value kind.", "enum": [ "text", "image", "document", "video", "location", "quick_action" ], "type": "string", "x-ms-enum": { "name": "MessageTemplateValueKind", "modelAsString": true } }, "MessageTemplateValueMedia": { "description": "The message template's media value information.\r\nCould be an image, document or video.", "type": "object", "properties": { "url": { "format": "uri", "description": "The (public) URL of the media.", "type": "string", "example": "https://www.example.com/image.png" }, "caption": { "description": "The [optional] caption of the media object.", "type": "string" }, "fileName": { "description": "The [optional] filename of the media file.", "type": "string" } } }, "MessageTemplateValueQuickAction": { "description": "The message template's quick action value information.", "type": "object", "properties": { "text": { "description": "The [Optional] quick action text", "type": "string", "example": "Yes" }, "payload": { "description": "The [Optional] quick action payload", "type": "string", "example": "cGF5bG9hZA==" } } }, "MessageTemplateValueText": { "description": "The message template's text value information.", "required": [ "text" ], "type": "object", "properties": { "text": { "description": "The text value.", "type": "string", "example": "John DOE" } } }, "MessageTemplateValueWhatsAppSubType": { "description": "The WhatsApp button sub type", "enum": [ "quickReply", "url" ], "type": "string", "x-ms-enum": { "name": "MessageTemplateValueWhatsAppSubType", "modelAsString": true } }, "SendMessageResult": { "description": "Result of the send message operation.", "required": [ "receipts" ], "type": "object", "properties": { "receipts": { "description": "Receipts of the send message operation.", "type": "array", "items": { "$ref": "#/definitions/MessageReceipt" } } } }, "SendNotificationRequest": { "description": "Details of the message to send.", "required": [ "channelRegistrationId", "to", "type" ], "type": "object", "properties": { "channelRegistrationId": { "description": "The Channel Registration ID for the Business Identifier.", "type": "string" }, "to": { "description": "The native external platform user identifiers of the recipient.", "type": "array", "items": { "type": "string" }, "example": [ "16315551234" ] }, "type": { "$ref": "#/definitions/CommunicationMessageType" }, "content": { "description": "Message content.", "type": "string", "example": "Come on everyone, lets go for lunch together." }, "mediaUri": { "description": "A media url for the file. Required if the type is one of the supported media types, e.g. image", "type": "string", "example": "https://IMAGE_URL" }, "template": { "$ref": "#/definitions/MessageTemplate" } } }, "TemplateResponse": { "type": "object", "properties": { "name": { "description": "Get the template's Name", "type": "string" }, "language": { "description": "Get the template's language", "type": "string" }, "channelType": { "$ref": "#/definitions/ChannelType" }, "status": { "$ref": "#/definitions/TemplateStatus" }, "whatsApp": { "$ref": "#/definitions/TemplateResponseWhatsApp" } } }, "TemplateResponseWhatsApp": { "description": "The WhatsApp-specific template response contract", "type": "object", "properties": { "content": { "description": "WhatsApp platform's template content\r\nThis is the payload returned from WhatsApp API." } } }, "TemplateStatus": { "description": "The aggregated template status.", "enum": [ "approved", "rejected", "pending", "paused" ], "type": "string", "x-ms-enum": { "name": "TemplateStatus", "modelAsString": true } } }, "parameters": { "ApiVersionParameter": { "in": "query", "name": "api-version", "description": "Version of API to invoke.", "required": true, "type": "string", "x-ms-parameter-location": "method" } }, "securityDefinitions": { "azure_auth": { "type": "oauth2", "flow": "implicit", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "scopes": { "user_impersonation": "impersonate your user account" } } }, "x-ms-parameterized-host": { "hostTemplate": "{endpoint}", "useSchemePrefix": false, "parameters": [ { "name": "endpoint", "description": "The communication resource, for example https://my-resource.communication.azure.com", "required": true, "type": "string", "format": "url", "in": "path", "x-ms-skip-url-encoding": true, "x-ms-parameter-location": "client" } ] } }