Enabling Custom Resolution Logic for SMS Messages

The dbo.sproc_SMSCustomContactResolution stored procedure is a hook-point for custom contact resolution based on the source address of an SMS message. By default, a contact whose Mobile property value matches with the source address is set in the interaction that is created from an incoming SMS message.

Organizations can implement their own methods to resolve contacts. For example, a student (essentially a contact) and his/her parents can share the same mobile number; or a contact may not have a mobile number, but one or more lead instances of the contact may have a value set in the Mobile property. In such scenarios, an organization can implement custom logic to determine how contact resolution must be achieved. The custom logic can be implemented using the sproc_SMSCustomContactResolution stored procedure.

Implementation

The SMSCustomContactResolution parameter in the tblGolobalInfo table determines the logic that must be invoked to implement contact resolution. This parameter can have one of the following values:

•   1 – Contacts can be resolved using custom logic written by the organization.

•   0 – Contacts are resolved using default behavior implemented in CampusNexus CRM.

The structure of this stored procedure ‘dbo.sproc_SMSCustomContactResolution’ is as follows:

CREATE PROCEDURE dbo.sproc_SMSCustomContactResolution (

@tMobileNumber NVARCHAR(50) /* INPUT PARAMETER: Takes Mobile Number (SMS From address) as input */

,@nCustomerID INT = - 1 OUTPUT /*OUTPUT PARAMETER: Should return the Contact ID resolved*/

,@tCustomerName NVARCHAR(255) = NULL OUTPUT /*OUTPUT PARAMETER: Should return the Contact Name resolved*/

,@bSMSSpammer INT = 0 OUTPUT /*OUTPUT PARAMETER: Should return the value 1 if the Contact is treated as Spammer. No Interaction instances will be created*/

,@bNewCustomer INT = 0 OUTPUT /*OUTPUT PARAMETER: Should return the value 1 if a new Contact is created*/

)

AS

BEGIN

SET NOCOUNT ON

BEGIN TRY

--Custom Contact resolution logic is written here

END TRY

BEGIN CATCH

--Exception handling code is written here

END CATCH

END

GO