Versions Compared

Key

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

Table of Contents

Table of Contents
maxLevel2
minLevel2
excludeTable of Contents

Send Message

This operation is used to send different type of messages to users in the application. 

Current Implementation

The supported type of messages are email and alert.

In order to be able to use this operation, a user must have 'send_messages' permission.

The current implementation delegates the actual message sending to Action Agent. This is an asynchronous operation. The current implementation will not wait until Action Agent comes back before returning to the client. The implication of this is that if Action Agent fails in delivering the message, the client of this operation is not notified. 

Parameters

Base URL: /communication/send

Parameters:

NameTypeMandatoryDescription
tokenStringYesSecurity Token obtained before.
userIdStringYesThe id of the logged in user.
typeENUMNo

Possible values: ['email', 'alert'].

Default value: "email".

This parameter identifies the type of message that must be sent.

senderIdStringIf type == 'email' -> No
If type == 'alert' -> Yes 
Id of the user used as sender. For messages of type 'email', this parameter is not mandatory. In this case, the sender is set as the receiver.
receiverIdStringYesId of the user that must receive the message.
templateIdStringYesId of the template that should be used for the message.
...StringNoAll the parameters (all the previously listed and any other parameter used in the invocation of this operation) are used as variables for the selected template. The template then could have, for example, the following variables: {userId}, {type}, {username}, {doctor}, etc.
Note
titleImportant
Note that ALL the parameters of the specified template must be present in the request.

API Sample

Happy Scenario

http://localhost:8080/PresentationServices/communication/send?token=d56c8e42-395e-4ba1-9bbb-73e5ed403f51&userId=poda&type=email&receiverId=354a7aae-ac06-4892-ac61-ce302351eb35&templateId=PasswordReset&link=http://fakeLink.com

Code Block
titleResult
collapsetrue
{
 statusFact: {
  success: true
 }
}

Not enough Permissions

In the case poda doesn't have 'send_messages' permission, the operation returns a 403 (Forbidden) error with the body "Not enough permissions.".