Skip to main content
Older versions of Internet Explorer will not support certain site features. Chrome, Safari, Firefox, and Edge will provide the best experience.
Spok

Spok Mobile Client-Initiated Message Flow Diagrams

Spok Mobile Client-Initiated Message Flow

The following diagram shows how a Spok Mobile message flows through the Care Connect Suite from a Spok Mobile client sender to a Spok Mobile client recipient. It shows which services and components are being used, how they interact with each other, and where the message waits for one service before moving on to the next.

Right-click on the diagram for options to see an expanded view.

 

Spok Mobile Client-Initiated Message Data Flow

The following diagram and corresponding descriptions provide details into the flow of message data through the Care Connect Suite for a message initiated at the Spok Mobile client. It depicts the objects sent between CCS components, which database tables are accessed, and the specific database fields that are written to and read. This diagram may be useful for troubleshooting issues since if you know which fields have been updated, it can show where the data stopped in the flow. 

Right-click on the diagram for options to see an expanded view.

Data Requests at Each Step

1. Interact with Client

2. Process message SM Client

2.1 Search for Contact

Contact {
    ContactId: {CONTACT_ID}
    Department: {DEPARTMENT_NAME}
    FirstName: {FIRST_NAME}
    LastName: {LAST_NAME}
    Group: ""
    Id: {CONTACT_CENTER_USER_ID}
    IsPageable: true|false
    IsSecure: true|false
    PicturePath: {PICTURE_PATH_URL}
    PublisherId: ""
    ReassignId: "0"
    ReassignName: ""
    Roles: ""
    StatusDescription: "In/On Pager"
    StatusFunction: "Available"
    Title: ""
    Type: "Person"|"Department"|"OnCallGroup"|"Team"|"OnCallRole"
}

    2.2 Store MessageAttachments – Optional

Store attachments in [AmcomAmcPremiseCore].[dbo].[AmcHostMessageAttachment] table if presented.

    2.3 Store MessageAssets – Optional

Store the link between attachments and assets in [AmcomAmcPremiseCore].[dbo].[MessageAsset] table.

    2.4 Send message to Contact Center

AddMessageRequest {
    AssetIds: []
    ConversationId: {CONVERSATION_ID}
    From: null
    Priority: {PRIORITY}
    Text: {MESSAGE_TEXT}
    To {
        Recipients: [{CONTACT_CENTER_USER_ID}],
        SiteId: {SITE_ID}
    }
}

3. Send Message to SM Server

<?xml version="1.0" encoding="UTF-8"?>
<amcomMessage>
    <header>
        <origin>{SYSTEM_NAME}</origin>
    </header>
    <newMessage>
        <from>
            <id>-{SENDER_ID}</id>
            <name>{SENDER_NAME}</name>
        </from>
        <conversationId>
            <trackingId>{MESSAGE_ID}</trackingId>
            <systemId>{SYSTEM_NAME}</systemId>
            <deviceId>{VENDOR_DEVICE_ID}</deviceId>
            <id>{CONVERSATION_ID}</id>
            <siteId>{SITE_ID}</siteId>
        </conversationId>
        <messageControls>
            <messageType>{MESSAGE_TYPE}</messageType>
            <priority>{PRIORITY}</priority>
            <dateTime>{DATE_TIME}</dateTime>
            <beepCode>2</beepCode>
            <messageVersion>1</messageVersion>
            <timeoutDevice>120</timeoutDevice>
            <timeoutUser>300</timeoutUser>
            <deviceType>{DEVICE_TYPE}</deviceType>
            <deviceBrand />
            <deviceOS>{DEVICE_OS}</deviceOS>
            <devicePort>{DEVICE_PORT}</devicePort>
            <deviceCarrier />
            <encryptionType>0</encryptionType>
        </messageControls>
        <recipient>
            <outputGateway>{GATEWAY}</outputGateway>
            <destination>{TELEPHINE_NUMBER}</destination>
        </recipient>
        <messageBody>
            <textMessage>{MESSAGE_TEXT}</textMessage>
            <responseChoices />
        </messageBody>
    </newMessage>
</amcomMessage>

4. Process message SM Server

4.1 Store Accepted

<?xml version="1.0" encoding="utf-16" standalone="no"?>
<amcomMessage>
    <header>
        <origin>{SYSTEM_NAME}</origin>
    </header>
    <messageNotification>
        <originator>
            <source>{TELEPHONE_NUMBER}</source>
        </originator>
        <conversationId>
            <trackingId>{MESSAGE_ID}</trackingId>
            <systemId>{SYSTEM_NAME}</systemId>
        </conversationId>
        <status>
            <dateTime>{DATE_TIME}</dateTime>
            <statusText>ACCEPTED</statusText>
        </status>
    </messageNotification>
</amcomMessage>

    4.2 Store Message

Store the message in [AmcomAmcPremiseCore].[dbo].[AmcHostMessages] table with Status QUEUED.

    4.3 Store Queued

<?xml version="1.0" encoding="utf-16" standalone="no"?>
<amcomMessage>
    <header>
        <origin>{SYSTEM_NAME}</origin>
    </header>
    <messageNotification>
        <originator>
            <source>{TELEPHONE_NUMBER}</source>
        </originator>
        <conversationId>
            <trackingId>{MESSAGE_ID}</trackingId>
            <systemId>{SYSTEM_NAME}</systemId>
        </conversationId>
        <status>
            <dateTime>{DATE_TIME}</dateTime>
            <statusText>QUEUED</statusText>
        </status>
    </messageNotification>
</amcomMessage>

    4.4 Send Push Notification to SM Hosted

Envelope {
    MessageType: "Amcom.Message.New",
    From {
        Id: "NotificationService",
        TypeId: "Amcom.Amc.Notification",
        SystemId: "Amcom.Amc.Server.Core"
    },
    To {
        Id: {NOTIFICATION_ADDRESS},
        TypeId: "Amcom.Amc.Notification",
        SystemId: "Amcom.Amc.MessageBroker.Service"
    },
    Content: NotificationRequest {
        NotificationAddress: {NOTIFICATION_ADDRESS},
                        GatewayType: GCM,
        CallbackUri: {ENTERPRISE_URL},
        CallbackData: {MESSAGE_UNIQUE_ID},
        Payload: PushPayload {
            ClientMessagingUrls: [{ENTERPRISE_URL}],
            MessageCount = {NUMBER_OF_MESSAGES},
            Priority = {PRIORITY},
            CoreVersion = {ENTERPRISE_VERSION}
        }    
    }
}

    4.5 Store Enroute

<?xml version="1.0" encoding="utf-16" standalone="no"?>
<amcomMessage>
    <header>
        <origin>{SYSTEM_NAME}</origin>
    </header>
    <messageNotification>
        <originator>
            <source>{TELEPHONE_NUMBER}</source>
        </originator>
        <conversationId>
            <trackingId>{MESSAGE_ID}</trackingId>
            <systemId>{SYSTEM_NAME}</systemId>
        </conversationId>
        <status>
            <dateTime>{DATE_TIME}</dateTime>
            <statusText>ENROUTE</statusText>
        </status>
    </messageNotification>
</amcomMessage>

5. Process Push Notification SM Hosted

5.1 Store Push Notification

Store the Notification in [AmcomAmcPremiseCore].[dbo].[Notifications] table on Hosted.

    5.2 Queue Push Notification

Queue the notification by inserting a record in [Core].[dbo].[MessageQueue].

    5.3 Send Push Notification

Android Payload:

{
    "collapse_key": "AMC",
    "registration_ids": ["{NOTIFICATION_ADDRESS}"],
    "data": {
        "message": "{\"ClientMessagingUrls\":[\"{ENTERPRISE_URL}\"],\"CoreVersion\":\"{ENTERPRISE_VERSION}\",\"MessageCount\":{NUMBER_OF_MESSAGES},\"Priority\":{PRIORITY}}",
        "time": {DATE_TIME}
    },
    "time_to_live": 259200 
}

Apple Payload:

Notification {
    DeviceToken: {NOTIFICATION_ADDRESS},
    Expiration: null,
    Payload: {"aps":{"content-available":1,"sound":""},"DeviceRequestType":"GetMessages"},
    Tag: null
}

    5.4 Get Message(s)

Request:

{ENTERPRISE_URL}/ClientMessaging/V2/GetMessages
Data: {vendorId: {VENDOR_DEVICE_ID}}

Response:

AmcGetMessagesResponse {
    ResponseType: "GetMessages",
    ResponseCode: 0,
    ResponseDescription: "Success"
    Messages: 
    [
        AmcMessage {
            UniqueId: {UNIQUE_ID},
            Date: {DATE_TIME},
            Text: {MESSAGE_TEXT},
            Status: 0,
            SiteId: {SITE_ID},
            ConversationId: {CONVERSATION_ID},
            CallbackNumber: {CALLBACK_NUMBER},
            Priority: {PRIORITY},
            MessageType: {MESSAGE_TYPE},
            Assets: [AmcAsset{}]
            From {
                Id: {FROM_ID},
                Name: {FROM_NAME},
                ContactId: {CONTACT_ID}
            }
        }
    ]
}

    5.5 Update Status to Delivered

UPDATE [AmcomAmcPremiseCore].[dbo].[AmcHostMessages] SET [Status] = "DELIVERED" WHERE [UniqueId] = {UNIQUE_ID}

    5.6 Store Delivered

<?xml version="1.0" encoding="utf-16" standalone="no"?>
<amcomMessage>
    <header>
        <origin>{SYSTEM_NAME}</origin>
    </header>
    <messageNotification>
        <originator>
            <source>{TELEPHONE_NUMBER}</source>
        </originator>
        <conversationId>
            <trackingId>{MESSAGE_ID}</trackingId>
            <systemId>{SYSTEM_NAME}</systemId>
        </conversationId>
        <status>
            <dateTime>{DATE_TIME}</dateTime>
            <statusText>DELIVERED</statusText>
        </status>
    </messageNotification>
</amcomMessage>