sp_On_Sms_In
sp_On_Email_In is triggered after a new incoming text (SMS) message has been received.
Remarks
This procedure should not be called directly by developer, it is automatically called by Boomerang services after completion of a job. This handler is invoked by Boomerang services both in event of success and failure.
Default body of this procedure is blank, thus user may provide their own code implementation for follow-up purposes.
Any changes to handler parameter list cannot be made. New parameters may add with future Boomerang releases upon which a notice will be sent separately.
Syntax
exec sp_On_Sms_In @rKey=... |
Parameters
Column Name | Data type | Direction | Description | Default | Status |
@rKey | uniqueidentifier | in | Message key rKey found in IN_SMS table | Required |
Return Code Values
0 (success) or non-zero (failure)
Examples
Send a automatic reply to sender.
ALTER procedure [dbo].[sp_On_Sms_In] ( @rKey uniqueidentifier ) as begin --- Demo Code Automatic Reply to Inbound SMS Messages ----- declare @ReplyToNumber varchar(50), @DteRec varchar(50), @gKey uniqueidentifier, @jKey uniqueidentifier --- Get senders phone number -------- select @ReplyToNumber = [From], @DteRec = convert(varchar(50),[Created_On]) from [dbo].[IN_SMS] where [rKey] = @rKey --- Send a reply SMS message ------- set @gKey = NEWID() set @jKey = NEWID() insert EVENT_MASTER(gKey, Str1) values (@gKey, 'Send SMS reply') insert OUT_SMS (gKey, jKey, [To], [Text]) values (@gKey, @jKey, @ReplyToNumber, 'Hello there!, We received your message at: ' + @DteRec) update EVENT_MASTER set Status = 0 where gKey = @gKey end |
Result:
See also
OUT_SMS
IN_SMS
sp_After_SMS_Job
sp_On_Sms_Status
sp_Resubmit_Sms
Configuring SMS Services – Twilio