Skip to content

Commit

Permalink
Rlarsson/add whatsapp template action (microsoft#828)
Browse files Browse the repository at this point in the history
* Added Whatsapp template send action

* Updated readme

* Fixed paconn warnings/errors

Co-authored-by: Robin Larsson <robin.larsson@arenainteractive.fi>
  • Loading branch information
robin-larsson and Robin Larsson authored May 19, 2021
1 parent 974ee78 commit 8ae80ed
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 3 deletions.
1 change: 1 addition & 0 deletions certified-connectors/SmartDialog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ This connector can be used to send and recieve SMS messages using the SmartDialo
## Supported Actions

- Send Message
- Send WhatsApp Message
- New Message (Trigger for recieving messages)
255 changes: 253 additions & 2 deletions certified-connectors/SmartDialog/apiDefinition.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,257 @@
],
"x-ms-visibility": "internal"
}
},
"/whatsapp/templates/{Customer-Id}": {
"get": {
"responses": {
"200": {
"description": "default",
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The Template name.",
"title": "Template Name",
"x-ms-visibility": "internal"
},
"displayName": {
"type": "string",
"description": "The template Displayname.",
"title": "Displayname"
},
"extensionParameters": {
"type": "object",
"properties": {
"rawContent": {
"type": "string",
"description": "The Templace content.",
"title": "Template Content",
"x-ms-visibility": "internal"
}
}
}
}
}
}
}
},
"operationId": "GetCustomerWhatsAppTemplates",
"summary": "Get Customer WhatsApp Templates",
"description": "Get the selected Customer's WhatsApp templates.",
"x-ms-visibility": "internal",
"parameters": [
{
"name": "Customer-Id",
"in": "path",
"x-ms-url-encoding": "single",
"required": true,
"type": "string"
}
]
}
},
"/messages/templates/whatsapp": {
"post": {
"responses": {
"200": {
"description": "default",
"schema": {
"type": "object",
"properties": {
"messageId": {
"type": "string",
"description": "Newly created message's identifier.",
"title": "Message Id"
},
"messagePartCount": {
"type": "integer",
"format": "int32",
"description": "Approximated number of message parts for this message.",
"title": "Message Part Count"
},
"recipients": {
"type": "array",
"items": {
"type": "object",
"properties": {
"address": {
"type": "string",
"description": "Recipient address (phone number/email/user id etc.).",
"title": "Recipient Address"
},
"id": {
"type": "string",
"description": "Recipient identifier used for receiving delivery status information.",
"title": "Recipient Id"
}
}
},
"description": "recipients"
}
}
}
}
},
"consumes": [
"application/json"
],
"operationId": "SendWhatsappTemplateMessage",
"x-ms-visibility": "important",
"summary": "Send WhatsApp Message",
"description": "Send WhatsApp template message.",
"parameters": [
{
"name": "Customer-Id",
"in": "header",
"required": true,
"type": "string",
"description": "The Customer to use for sending.",
"x-ms-summary": "Customer",
"x-ms-visibility": "important",
"x-ms-dynamic-values": {
"operationId": "GetUserCustomers",
"value-path": "customerId",
"value-collection": "customerUsers",
"value-title": "customerName"
}
},
{
"name": "Service-Id",
"in": "header",
"required": true,
"type": "string",
"description": "The Service to use for sending.",
"x-ms-summary": "Service",
"x-ms-visibility": "important",
"x-ms-dynamic-values": {
"operationId": "GetCustomerServices",
"value-path": "id",
"value-title": "name",
"parameters": {
"Customer-Id": {
"parameter": "Customer-Id"
},
"ServiceType": "OneWay"
}
}
},
{
"name": "Request Body",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"TemplateName": {
"type": "string",
"description": "The Template to use for sending.",
"title": "WhatsApp Template",
"x-ms-visibility": "important",
"x-ms-dynamic-values": {
"operationId": "GetCustomerWhatsAppTemplates",
"value-path": "id",
"value-title": "extensionParameters/rawContent",
"parameters": {
"Customer-Id": {
"parameter": "Customer-Id"
}
}
}
},
"Recipients": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Address": {
"type": "string",
"description": "Message recipient address.",
"title": "Address"
}
},
"required": [
"Address"
]
},
"description": "Recipients"
},
"BodyParameters": {
"type": "array",
"items": {
"type": "string",
"description": "Array of string parameters to be used in the body of the selected template.",
"title": "Template Body Parameters",
"x-ms-visibility": "important"
},
"description": "BodyParameters"
},
"HeaderParameters": {
"type": "array",
"items": {
"type": "string",
"description": "Array of string parameters to be used in the header of the selected template.",
"title": "Template Header Parameters"
},
"description": "HeaderParameters"
},
"Buttons": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Type": {
"type": "string",
"description": "The button type. Only one type per template, may contain multiple of the same type.",
"title": "Type",
"enum": [
"Call",
"QuickReply",
"Url"
]
},
"Data": {
"type": "string",
"description": "The text of the button.",
"title": "Text"
}
}
},
"description": "Buttons"
},
"SendDateTime": {
"type": "string",
"description": "The date and time to send the message. Leave empty to send instantly.",
"title": "Send Datetime"
},
"AttachmentUri": {
"type": "string",
"description": "The Attachment Uri if the template contains an attachment.",
"title": "Attachment Uri"
},
"UseSmsFallback": {
"type": "boolean",
"description": "Should SMS be used as fallback.",
"title": "Use SMS Fallback"
},
"DlrUrl": {
"type": "string",
"description": "Delivery report Url that will recieve a callback when the sendprocess completes.",
"title": "Dlr Url"
}
},
"required": [
"TemplateName",
"Recipients",
"BodyParameters"
]
}
}
]
}
}
},
"x-ms-connector-metadata": [
Expand All @@ -519,14 +770,14 @@
"authorizationUrl": "https://arenafi.b2clogin.com/arenafi.onmicrosoft.com/B2C_1A_SmartDialog_Integrations/oauth2/v2.0/authorize",
"tokenUrl": "https://arenafi.b2clogin.com/arenafi.onmicrosoft.com/B2C_1A_SmartDialog_Integrations/oauth2/v2.0/token",
"scopes": {
"offline_access https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Gateway.Send https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Customer.Services https://arenafi.onmicrosoft.com/smartdialog-integrations-api/User.Customers https://arenafi.onmicrosoft.com/smartdialog-integrations-api/TwoWay.Management": "offline_access https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Gateway.Send https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Customer.Services https://arenafi.onmicrosoft.com/smartdialog-integrations-api/User.Customers https://arenafi.onmicrosoft.com/smartdialog-integrations-api/TwoWay.Management"
"offline_access https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Gateway.Send https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Customer.Services https://arenafi.onmicrosoft.com/smartdialog-integrations-api/User.Customers https://arenafi.onmicrosoft.com/smartdialog-integrations-api/TwoWay.Management https://arenafi.onmicrosoft.com/smartdialog-integrations-api/WhatsApp": "offline_access https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Gateway.Send https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Customer.Services https://arenafi.onmicrosoft.com/smartdialog-integrations-api/User.Customers https://arenafi.onmicrosoft.com/smartdialog-integrations-api/TwoWay.Management https://arenafi.onmicrosoft.com/smartdialog-integrations-api/WhatsApp"
}
}
},
"security": [
{
"oauth2_auth": [
"offline_access https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Gateway.Send https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Customer.Services https://arenafi.onmicrosoft.com/smartdialog-integrations-api/User.Customers https://arenafi.onmicrosoft.com/smartdialog-integrations-api/TwoWay.Management"
"offline_access https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Gateway.Send https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Customer.Services https://arenafi.onmicrosoft.com/smartdialog-integrations-api/User.Customers https://arenafi.onmicrosoft.com/smartdialog-integrations-api/TwoWay.Management https://arenafi.onmicrosoft.com/smartdialog-integrations-api/WhatsApp"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion certified-connectors/SmartDialog/apiProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"identityProvider": "oauth2",
"clientId": "<clientId>",
"scopes": [
"offline_access https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Gateway.Send https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Customer.Services https://arenafi.onmicrosoft.com/smartdialog-integrations-api/User.Customers https://arenafi.onmicrosoft.com/smartdialog-integrations-api/TwoWay.Management"
"offline_access https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Gateway.Send https://arenafi.onmicrosoft.com/smartdialog-integrations-api/Customer.Services https://arenafi.onmicrosoft.com/smartdialog-integrations-api/User.Customers https://arenafi.onmicrosoft.com/smartdialog-integrations-api/TwoWay.Management https://arenafi.onmicrosoft.com/smartdialog-integrations-api/WhatsApp"
],
"redirectMode": "Global",
"redirectUrl": "https://global.consent.azure-apim.net/redirect",
Expand Down

0 comments on commit 8ae80ed

Please sign in to comment.