This workflow allows someone to text in a prayer request and have it entered into the prayer section in Rock. If Rock is able to match the phone number to a person, the request will be attributed to that person. If Rock can't find a match, the request will be entered anonymously.

This workflow will work with either the SMS Pipeline or the legacy Text-to-Workflow webhook.

SMS Pipeline Setup Example

Pipeline Screenshot

Settings

Message Regular Expression options
^\s*pray .* (This will match any message beginning with "pray ")
^.*pray.*$ (This will match any message with "pray" anywhere in it)

Workflow Attributes

  • FromPerson {{ FromPerson.PrimaryAlias.Guid }}
  • FromPhone {{ FromPhone }}
  • Message {{ MessageBody }}

As of Rock v11, there is now a "Prayer Request Add" workflow action in the "Person" category. While the SQL presented in this recipe still works, it is probably best to use the new action where possible.

Workflow Export

If you are using Rock v9+, you can download sms-prayer-request.json to import the workflow.

Screenshot

If you are unable to import the workflow, you can recreate it manually based on the screenshot below. (Scroll all the way down for copy/paste friendly text from each of the actions)

Workflow Screenshot

Text for the workflow actions

Add Named Request
INSERT INTO [PrayerRequest] (
    [FirstName]
    ,[LastName]
    ,[Text]
    ,[EnteredDateTime]
    ,[CreatedDateTime]
    ,[ModifiedDateTime]
    ,[Guid]
    ,[RequestedByPersonAliasId]
) VALUES (
    @FirstName
    ,@LastName
    ,@Message
    ,GETDATE()
    ,GETDATE()
    ,GETDATE()
    ,NEWID()
    ,@RequestedByPersonAliasId
)
Parameters
  • FirstName {{ Workflow | Attribute:'FromPerson','FirstName' | SanitizeSql }}
  • LastName {{ Workflow | Attribute:'FromPerson','LastName' | SanitizeSql }}
  • Message {{ Workflow | Attribute:'Message' | SanitizeSql }}
  • RequestedByPersonAliasId {{ Workflow | Attribute:'FromPerson','PrimaryAliasId' | SanitizeSql }}
Add Anon Request
INSERT INTO [PrayerRequest] (
    [FirstName]
    ,[Text]
    ,[EnteredDateTime]
    ,[CreatedDateTime]
    ,[ModifiedDateTime]
    ,[Guid]
) VALUES (
    'Anonymous'
    ,@Message
    ,GETDATE()
    ,GETDATE()
    ,GETDATE()
    ,NEWID()
)
Parameters
  • Message {{ Workflow | Attribute:'Message' | SanitizeSql }}
Create Response
{%- assign fromName = Workflow | Attribute:'FromPerson','NickName' -%}
{%- if fromName != empty %}Thanks {{ fromName }}. {% endif -%}
We have received your request, and will forward it to our prayer team.