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

Contact Center-Initiated Spok Mobile Message Flow Diagrams

This article contains diagrams which depict how message data flows from the Contact Center to the Spok Mobile client.

Contact Center-Initiated Spok Mobile Message Flow

The following diagram shows how a message flows through the Care Connect Suite from the Contact Center to the Spok Mobile client. It shows which services and components are 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.

SM_4.4_Local-Message-Flow.png

 

Contact Center-Initiated Spok Mobile Message Data Flow 

The following diagram provides details about how message data flows through the Care Connect Suite from the Contact Center to 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 from. This diagram may be useful for troubleshooting issues, because if you know which fields have already been updated, you can determine where the data stopped in the flow.

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

SM_4.4_Local-Message-Data-Flow.png

Data Requests at Each Step

1. Send Message to Spok Mobile 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>

2. Process Message on Spok Mobile Server

2.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>

    2.2 Store Message

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

    2.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>

    2.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}
        }    
    }
}

    2.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>

3. Process Push Notification SM Hosted

3.1 Store Push Notification

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

    3.2 Queue Push Notification

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

    3.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
}

    3.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}
            }
        }
    ]
}

    3.5 Update Status to Delivered

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

    3.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>