ASPsms notification

🟢 Beginner

notification

This example shows how to configure SMS notifications using the ASPsms provider: set up the provider credentials, create a notification with a FreeMarker template, and define an output linked to a contact.

  • Configure an ASPsms provider with credentials and a status value.

  • Create a notification referencing a FreeMarker template for the SMS body.

  • Define an output linked to a contact from the directory.

  • Monitor the provider status from a dashboard widget.

git checkout origin/osp-communications-configuration .
git checkout origin/osp-reports-configuration .
git checkout origin/example-communications-configure-aspsms-notification .

Structure

@startuml
skinparam backgroundColor transparent

package "root" as root {
    package "providerSMS" as provider {
        [providers.coms] as provComs
        [value.ospp] as valueSMS
    }

    package "directory" as contact {
        [contacts.coms] as contacts
    }

    package "notification" as notification {
        [notification.coms] as notif
        [output.coms] as output
        package "template" as templates {
            [template.ftl] as templateftl
            [template.ospp] as templateProperty
            [template.reports] as templateReports
        }
    }

    [dashboard.view] as dash
}

node communication as "osp-communications"
node report as "osp-reports"

report -[#blue]-> templateReports : **Own**
templateReports -[#blue]-> templateftl
communication -[#blue]-> provComs : **Own**
communication -[#blue]-> contacts : **Own**
communication -[#blue]-> notif : **Own**
valueSMS -[#black]-> dash : **Give provider status**
output -[#red]-> notif
notif -[#black]-> templateReports : **Use**
notif -[#black]-> provComs
output -[#black]-> contacts : **Use**
@enduml

Steps

1. Configure the ASPSMS provider

root/providerSMS/provider.coms

{
    "moduleId": "modules.communications.communications-1",
    "providerType": "ASPSMS",
    "username": "${YOUR_USERNAME}",
    "passwordProvider": {
        "type": "PLAINTEXT",
        "password": "${YOUR_PASSWORD}"
    }
}

root/providerSMS/value.ospp

{
    "name": "ASPSMS Provider Value",
    "description": "",
    "type": "BOOLEAN"
}

2. Create the notification with the template

root/notification/notification.coms

{
  "moduleId": "modules.communications.communications-1",
  "template": {
    "shortMessageTemplateId": "root.notification.short"
  },
  "accessedValues": []
}

root/notification/short/template.ospp

{
    "description": "",
    "format": "plain",
    "name": ""
}

root/notification/short/template.reports

{
    "moduleId": "modules.reports.reports-1",
    "baseTemplatePath": "root/notification/short/template.ftl"
}

root/notification/short/template.ftl

Change on ${trigger["name"]}

3. Create the output and the contact

root/notification/output.coms

{
  "notificationId": "root.notification",
  "targets": [
    {
      "originator": {
        "smsSender": "OnSphere"
      },
      "providers": [
        {
          "providerId": "root.providerSMS"
        }
      ],
      "recipient": {
        "type": "FROM_STATIC_LIST",
        "contactsId": "root.directory"
      }
    }
  ]
}

root/directory/contacts.coms

{
    "moduleId": [
        "modules.communications.communications-1"
    ],
    "contacts": [
        {
            "type": "PERSONAL",
            "firstname": "Bob",
            "lastname": "Morane",
            "email": "bob.morane@localhost",
            "number": "0791234567"
        },
        {
            "type": "PERSONAL",
            "firstname": "Titi",
            "lastname": "Minet",
            "email": "titi.minet@localhost",
            "number": "0791234567"
        },
        {
            "type": "PERSONAL",
            "firstname": "Code",
            "lastname": "Lyoko",
            "email": "code.lyoko@localhost",
            "number": "0791234567"
        }
    ]
}