Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Beskrivning

Funktion som hanterar utgående kommunikation till våra intressenter.

Kommunikationsmöjligheter:

Bubblare:

  • Analog post

  • App-push

Dessutom sparas, för identifierade mottagare, kommunikationshistorik.

Livscykelstatus

Under utveckling

Lösningsbeskrivning

Gliffy
imageAttachmentIdatt29425686
macroId5403c848-f47c-4944-9cae-039096781462
baseUrlhttps://sundsvall.atlassian.net/wiki
namemessagingAPI
diagramAttachmentIdatt30179333
containerId30081025
timestamp1641819939751

Hantering av personuppgifter

Vilka personuppgifter hanteras och varför?

API-specifikation

För att skicka meddelanden görs ett POST-anrop till /messages. Mottagarna anges i form av en lista med personId, som messaging använder för att slå upp respektive mottagares återkopplingsinställningar från feedbacksettings. Anroparen kan skicka med både ett längre och ett kortare meddelande som används beroende på om mottagaren vill ha e-post eller SMS skickat till sig.

POST /messages

Code Block
languagejson
{
  "sender" : "Sundsvalls Kommun",
  "recipients" : [
    "15aee472-46ab-4f03-9605-68bd64ebc73f"
  ],
  "subject": "Ämnesrad för e-post",
  "message" : "Ett längre meddelande som kan skickas som e-post",
  "shortMessage" : "Ett kortare meddelande som kan skickas via SMS"
}

POST /messages/sms

Code Block
languagejson
{
  "sender" : "Sundsvalls Kommun"
  "mobileNumber" : "0701234567",
  "personId" : "435rfret45", //optional
  "message" : "Text. bla bla"
}

POST /messages/email

Code Block
languagejson
{
  "sender" : "Sundsvalls Kommun <noreply@sundsvall.se>",
  "emailAddress" : "test@test.se",
  "personId" : "435rfret45", //optional
  "subject": "Ämnesrad för e-postmeddelandet"
  "message" : "Text. bla bla",
  "htmlMessage": "<BASE64-encode:ad HTML>",
  "attachments" : [
    {
      "name": "<bilagans filnamn>",
      "contentType": "<bilagans content type>",
      "content": "<BASE64-encode:at filinnehåll>"
    },
    ...
  ]
}

GET /messages/status/{messageId}

Code Block
languagejson
[ <TODO> ]

GET /messages/{personId}/conversationHistory

[ <TODO> ]
Code Block
languagejson
Swagger ui
openapi: 3.0.1
info:
  title: Messaging
  contact: {}
  license:
    name: MIT License
    url: https://opensource.org/licenses/MIT
  version: "2.0"
tags:
- name: Sending Resources
- name: Status and History Resources
paths:
  /webmessage:
    post:
      tags:
      - Sending Resources
      summary: Send a single web message
      operationId: sendWebMessage
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebMessageRequest'
        required: true
      responses:
        "400":
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "500":
          description: Internal Server Error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "200":
          description: Successful Operation
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/MessageResponse'
  /sms:
    post:
      tags:
      - Sending Resources
      summary: Send a single SMS
      operationId: sendSms
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SmsRequest'
        required: true
      responses:
        "400":
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "500":
          description: Internal Server Error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "200":
          description: Successful Operation
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/MessageResponse'
  /messages:
    post:
      tags:
      - Sending Resources
      summary: Send a batch of messages as e-mail or SMS to a list of parties
      operationId: sendMessage
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageRequest'
        required: true
      responses:
        "400":
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "500":
          description: Internal Server Error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "200":
          description: Successful Operation
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/MessagesResponse'
  /email:
    post:
      tags:
      - Sending Resources
      summary: Send a single e-mail
      operationId: sendEmail
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailRequest'
        required: true
      responses:
        "400":
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "500":
          description: Internal Server Error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "200":
          description: Successful Operation
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/MessageResponse'
  /status/{messageId}:
    get:
      tags:
      - Status and History Resources
      summary: Get the status for a single message
      operationId: getMessageStatus
      parameters:
      - name: messageId
        in: path
        required: true
        schema:
          type: string
      responses:
        "500":
          description: Internal Server Error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "404":
          description: Not Found
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "200":
          description: Successful Operation
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/MessageStatusResponse'
  /conversationHistory/{partyId}:
    get:
      tags:
      - Status and History Resources
      summary: Get the entire conversation history for a given party
      operationId: getConversationHistory
      parameters:
      - name: partyId
        in: path
        required: true
        schema:
          type: string
      - name: fromDate
        in: query
        description: "Format: yyyy-MM-dd (ISO8601)"
        required: false
        schema:
          type: string
          format: date
      - name: toDate
        in: query
        description: "Format: yyyy-MM-dd (ISO8601)"
        required: false
        schema:
          type: string
          format: date
      responses:
        "500":
          description: Internal Server Error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "200":
          description: Successful Operation
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/HistoryResponse'
  /batchStatus/{batchId}:
    get:
      tags:
      - Status and History Resources
      summary: Get the status for a message batch
      operationId: getBatchStatus
      parameters:
      - name: batchId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Successful Operation
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/BatchStatusResponse'
        "500":
          description: Internal Server Error
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
        "404":
          description: Not Found
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Problem'
  /api-docs:
    get:
      tags:
      - API
      summary: OpenAPI
      operationId: getApiDocs
      responses:
        "200":
          description: OK
          content:
            application/yaml:
              schema:
                type: string
      x-auth-type: None
      x-throttling-tier: Unlimited
      x-wso2-mutual-ssl: Optional
components:
  schemas:
    ExternalReference:
      required:
      - key
      - value
      type: object
      properties:
        key:
          type: string
          description: The external reference key
          example: flowInstanceId
        value:
          type: string
          description: The external reference value
          example: 356t4r34f
      description: External references
    Header:
      required:
      - name
      - values
      type: object
      properties:
        name:
          type: string
          description: The header name
        values:
          type: array
          description: The header values
          items:
            type: string
            description: The header values
    Party:
      type: object
      properties:
        partyId:
          type: string
          description: The message party ID
          example: f427952b-247c-4d3b-b081-675a467b3619
        externalReferences:
          type: array
          description: External references
          items:
            $ref: '#/components/schemas/ExternalReference'
    WebMessageRequest:
      required:
      - message
      type: object
      properties:
        party:
          $ref: '#/components/schemas/Party'
        headers:
          type: array
          items:
            $ref: '#/components/schemas/Header'
        message:
          type: string
    Problem:
      type: object
      properties:
        instance:
          type: string
          format: uri
        type:
          type: string
          format: uri
        parameters:
          type: object
          additionalProperties:
            type: object
        status:
          $ref: '#/components/schemas/StatusType'
        title:
          type: string
        detail:
          type: string
    StatusType:
      type: object
      properties:
        reasonPhrase:
          type: string
        statusCode:
          type: integer
          format: int32
    MessageResponse:
      type: object
      properties:
        messageId:
          type: string
    Sms:
      required:
      - name
      type: object
      properties:
        name:
          maxLength: 11
          minLength: 0
          type: string
          description: The sender of the SMS
          example: sender
    SmsRequest:
      required:
      - message
      - mobileNumber
      type: object
      properties:
        party:
          $ref: '#/components/schemas/Party'
        headers:
          type: array
          items:
            $ref: '#/components/schemas/Header'
        sender:
          $ref: '#/components/schemas/Sms'
        mobileNumber:
          pattern: "^\\+467[02369]\\d{7}$"
          type: string
          description: Mobile number. Should start with +467x
        message:
          type: string
    Email:
      required:
      - address
      - name
      type: object
      properties:
        name:
          type: string
          description: The sender of the e-mail
        address:
          type: string
          description: Sender e-mail address
          example: sender@sender.se
        replyTo:
          type: string
          description: Reply-to e-mail address
          example: sender@sender.se
    Message:
      required:
      - message
      type: object
      properties:
        party:
          $ref: '#/components/schemas/Party'
        headers:
          type: array
          items:
            $ref: '#/components/schemas/Header'
        sender:
          $ref: '#/components/schemas/Sender'
        subject:
          type: string
          description: The message subject (for E-mails)
        message:
          type: string
          description: The message text
      description: A message to be sent
    MessageRequest:
      type: object
      properties:
        messages:
          type: array
          description: The messages to be sent
          items:
            $ref: '#/components/schemas/Message'
      description: Message representation
    Sender:
      type: object
      properties:
        sms:
          $ref: '#/components/schemas/Sms'
        email:
          $ref: '#/components/schemas/Email'
      description: Sender
    MessagesResponse:
      type: object
      properties:
        batchId:
          type: string
        messageIds:
          type: array
          items:
            type: string
    Attachment:
      required:
      - content
      - name
      type: object
      properties:
        content:
          type: string
          description: The attachment (file) content as a BASE64-encoded string
          example: aGVsbG8gd29ybGQK
        name:
          type: string
          description: The attachment filename
          example: test.txt
        contentType:
          type: string
          description: The attachment content type
          example: text/plain
      description: Attachments
    EmailRequest:
      required:
      - emailAddress
      - subject
      type: object
      properties:
        party:
          $ref: '#/components/schemas/Party'
        headers:
          type: array
          items:
            $ref: '#/components/schemas/Header'
        emailAddress:
          type: string
          description: Recipient e-mail address
          example: recipient@recipient.se
        subject:
          type: string
          description: E-mail subject
        message:
          type: string
          description: E-mail plain-text body
        htmlMessage:
          type: string
          description: E-mail HTML body (BASE64-encoded)
        sender:
          $ref: '#/components/schemas/Email'
        attachments:
          type: array
          description: Attachments
          items:
            $ref: '#/components/schemas/Attachment'
    MessageStatusResponse:
      type: object
      properties:
        messageId:
          type: string
        status:
          type: string
          enum:
          - AWAITING_FEEDBACK
          - PENDING
          - SENT
          - FAILED
          - NO_FEEDBACK_SETTINGS_FOUND
          - NO_FEEDBACK_WANTED
    HistoryResponse:
      type: object
      properties:
        messageType:
          type: string
          enum:
          - MESSAGE
          - EMAIL
          - SMS
          - WEB_MESSAGE
        status:
          type: string
          enum:
          - AWAITING_FEEDBACK
          - PENDING
          - SENT
          - FAILED
          - NO_FEEDBACK_SETTINGS_FOUND
          - NO_FEEDBACK_WANTED
        content:
          type: object
        timestamp:
          type: string
          format: date-time
    BatchStatusResponse:
      type: object
      properties:
        messageStatuses:
          type: array
          items:
            $ref: '#/components/schemas/MessageStatusResponse'
  securitySchemes: {}

Säkerhetsklassning

Säkerhetsklass 1

Autentiseringsmetod: Oauth2

(Ref: Säkerhetsklassning av APIer )

API-ägare

<Kontaktuppgifter till den verksamhet som äger APIets livscykel>

Teknisk ägare

https://sundsvall.atlassian.net/wiki/spaces/API

Ansvarigt team: Team Dynasty

För tekniska frågor: teamdynasty@sundsvall.se

Länkar

<Länkar till dev-portal;

  • Test

  • Sandbox

  • Produktion>

FAQ

<FAQ>

Create from Template
spaceKeySK
templateName22151177
templateId22151177
buttonLabelSkapa från Template