Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
Send secure message to call center group

I'm trying to send a secure message from online banking to our call center group on Q2Central but it looks like all of the SendSecureMessage API calls are for sending messages to the member.

Any suggestions on how I would do this?

Posted 5 years ago
Mark Ostroth
309 × 5 Administrator
Votes Newest

Answers


Hey. This is some code that allows me to send a secure message to our Operations group in central.

imports of:

import q2_sdk.core.web
from q2_sdk.ui import fields, forms
from q2_sdk.hq.hq_api.q2_api import SendSecureMessage
from q2_sdk.hq.hq_api.q2_api import SendNotification
from q2_sdk.core.configuration import settings
from q2_sdk.core.install_steps.db_plan import DbPlan
from q2_sdk.hq.hq_api.q2_api import SendSecureMessageAsXml
from q2_sdk.hq.api_helpers import build_secure_message_xml
from q2_sdk.hq.models.secure_messenger_type import SecureMessengerType
from q2_sdk.hq.db.message_recipient_group import MessageRecipientGroup

code snippet:

    # source_csr_id is the from, which we want to be the customer's ID
    # target_id is the to, which we want to be the Customer Service group
    first_name = self.online_user.first_name
    last_name = self.online_user.last_name
    message_subject = "Travel Notification Submission: " + first_name + " " + last_name
    cn_customer_service_group_id = 0
		  customer_user_id = self.online_user.user_id
		  cn_secure_message = "test message"

    try:
        cn_admin_group_que = MessageRecipientGroup(self.logger, self.hq_credentials)

        cn_admin_group_response_list = await cn_admin_group_que.get()
        for group in cn_admin_group_response_list:
            if group.GroupName == "Operations":
                cn_customer_service_group_id = group.GroupID
            # self.logger.info("Group Name: " + str(x.GroupName))
            # self.logger.info("Group ID: " + str(x.GroupID))
            # self.logger.info("Group VisibleToEndUser: " + str(x.VisibleToEndUser))
            # self.logger.info("Group Description: " + str(x.GroupDescription))
            # self.logger.info("Group AllowReplies: " + str(x.AllowReplies))

            # print("Group Name: " + str(x.GroupName))
            # print("Group ID: " + str(x.GroupID))
            # print("Group VisibleToEndUser: " + str(x.VisibleToEndUser))
            # print("Group Description: " + str(x.GroupDescription))
            # print("Group AllowReplies: " + str(x.AllowReplies))
    except Exception as err:
        self.logger.info("Error for: " + first_name + " " + last_name + ": " + str(err))


    message_xml_payload = build_secure_message_xml(
        customer_user_id, cn_customer_service_group_id, message_subject, cn_secure_message,
        SecureMessengerType.EndUser, SecureMessengerType.AdministratorGroup, None, None
    )

    message_params = SendSecureMessageAsXml.ParamsObj(self.logger, message_xml_payload, self.hq_credentials)

    response = await SendSecureMessageAsXml.get_json(message_params)
    self.logger.info("Response for " + first_name + " " + last_name + ": " + str(response))
152 Views
1 Answer
5 years ago
5 years ago
Tags