LogoLogo
Give FeedbackGovStack Home
1.0
1.0
  • Messaging
  • 1 Version History
  • 2 Description
  • 3 Terminology
  • 4 Key Digital Functionalities
  • 5 Cross-Cutting Requirements
  • 6 Functional Requirements
  • 7 Data Structures
  • 8 Service APIs
  • 9 Internal Workflows
  • 10 Other Resources
Powered by GitBook

Copyright © 2024

On this page

Was this helpful?

Export as PDF

8 Service APIs

This section provides a reference for APIs that should be implemented by this Building Block.

Last updated 1 year ago

Was this helpful?

This section provides a reference for APIs that should be implemented by this Building Block. The APIs defined here establish a blueprint for how the Building Block will interact with other Building Blocks. Additional APIs may be implemented by the Building Block, but the listed APIs define a minimal set of functionality that should be provided by any implementation of this Building Block.

The provides additional information on how 'adaptors' may be used to translate an existing API to the patterns described here. This section also provides guidance on how candidate products are tested and how GovStack validates a product's API against the API specifications defined here.

The tests for the Messaging Building Block can be found in

8.1 Government to person (G2P)

8.1.1 Sending emails

8.1.1.1 Sending single emails one by one

This API is designed to send out emails one by one.

Although an email can be sent to multiple recipients by using email, emailCC and emailBCC appropriately, this is still considered as sending a single email.

Sample user story

As a Doctor working in a hospital, I want to notify my patient about a confirmed registration so that the patient would know when to come for a visit.

API endpoint

8.1.1.2 Sending multiple (batch) emails at once

This API is designed to send out identical emails to multiple (batch) recipients at once.

Sample user story

As a Hospital I want to notify a specified group of my clients about the possibility to register to vacant time slots within a limited period of time so that the clients potentially needing it the most would have a guaranteed chance to get an appointment

API endpoint

8.2 Person to Government (P2G)

8.2.1 Responding to emails

This API is designed to accept responses to emails that have been previously sent out by using the Messaging Building Block. The protocol itself is lightweight and expects custom services from anyone using it. The Messaging Building Block is responsible for delivering the message and does not know (or want to know) anything about the content of it, how it will be used, etc.

Sample user story

As a Hospital, I want to get and send responses from and to clients so that I could continue and keep track of email conversations taking place via GovStack

API endpoint

8.2.2 Reading the status of emails

This API is designed to provide information about the status of emails sent to the Messaging Building Block.

Sample user story

As a Doctor working in a hospital I want to know which emails I have sent haven't reached their destination so that I could contact such patients by using different means

API endpoint

Status of emails

Possible status of emails that can be queried are as follows:

  1. scheduled

  2. processing

  3. deferred

  4. bounced

  5. not sent

  6. delivered

There is no keeping track of emails which have been sent successfully, as this would end up creating and maintaining a massive database of emails, their senders and recipients, etc., which would be wrong for so many reasons.

GovStack non-functional requirements document
this GitHub repository.

Send a single email

post
Query parameters
Header parameters
apiKeystringRequired
Responses
200
Request successfully accepted
application/json
405
Invalid input
post
POST /send/email/single?body=[object+Object] HTTP/1.1
Host: 
apiKey: text
Accept: */*
{
  "response": "Request successfully accepted. Use \\\"requestUid\\\" to track it's status.",
  "requestUid": "UfQK-CPju-Ea5B-6y7X-8A72-VqU5"
}

An optional custom service to provide an endpoint for client-specific functionality to accept replied emails, etc

post

This service may reside on both Messaging BB's and client's side. If used, a matching OpenAPI spec must be provided by the service provider, describing the expected input when making request to the endpoint.

Query parameters
Header parameters
apiKeystringRequired
requestUidstringRequired
Responses
200
Request successfully accepted
405
Invalid input
post
POST /callback/email?body=[object+Object] HTTP/1.1
Host: 
apiKey: text
requestUid: text
Accept: */*

No content

Get an overview of sent emails statuses

get

Get status of sent emails. Use both "apiKey" and "requestUid" in your request.

Query parameters
Header parameters
apiKeystringRequired
requestUidstringRequired
Responses
200
Request successfully accepted
application/json
405
Invalid input
get
GET /status/email?status=scheduled HTTP/1.1
Host: 
apiKey: text
requestUid: text
Accept: */*
{
  "scheduled": 0,
  "processing": 1004,
  "deferred": 0,
  "bounced": 257,
  "notSent": 0,
  "delivered": 9032
}
  • 8.1 Government to person (G2P)
  • 8.1.1 Sending emails
  • 8.1.1.1 Sending single emails one by one
  • POSTSend a single email
  • 8.1.1.2 Sending multiple (batch) emails at once
  • POSTSend batch emails
  • 8.2 Person to Government (P2G)
  • 8.2.1 Responding to emails
  • POSTAn optional custom service to provide an endpoint for client-specific functionality to accept replied emails, etc
  • 8.2.2 Reading the status of emails
  • GETGet an overview of sent emails statuses

Send batch emails

post

When sending batch emails, recipients information is passed in base64 format. Sender information and email content must be the same for all recipients.

Query parameters
Header parameters
apiKeystringRequired
Body
stringOptional
Responses
200
Request successfully accepted
application/json
405
Invalid input
post
POST /send/email/batch?body=[object+Object] HTTP/1.1
Host: 
apiKey: text
Content-Type: application/json
Accept: */*
Content-Length: 6

"text"
{
  "response": "Request successfully accepted. Use \\\"requestUid\\\" to track it's status.",
  "requestUid": "UfQK-CPju-Ea5B-6y7X-8A72-VqU5"
}