Question

Photo of Dan Dietz

0

Webhook Data to Workflow Fields

How can I get data posted to the webhook endpoint into my workflow fields?

For my webhook Defined Value I have Process Request:

{% assign workflowTypeId = QueryString['WorkflowTypeId'] %} {% if workflowTypeId == '33' %} True {% else %} False {% endif %}

And I have Workflow Attributes set to (I've tried several variations on this):

Attribute Key: Body

Lava Template: {{ RawBody }}


Here's my request:

curl -i --header "Content-Type: application/json" \

  --request POST \

  --data '{"firstName":"dan"}' \

  https://rock.gracechurchsc.dev/Webhooks/LaunchWorkflow.ashx?WorkflowTypeId=33


And I've added an Action to the workflow form that's type Lava Run with this lava:

{% assign body = Workflow | Attribute:'Body' | FromJSON %}

{{ body.firstName }}


Workflow docs don't show a complete concrete example, so I'm struggling to connect all the dots-

https://community.rockrms.com/documentation/BookContent/12#webhooktoworkflow

  • Photo of Michael Allen

    0

    I recreated this setup based on your description above, and it appears to be working for me.

    Since you aren't seeing any JSON under the entry details, it sounds like you may be missing the "Body" attribute in your workflow? It would need to be a "text" or "memo" type attribute, and is where you would expect to see the JSON you are POSTing.


  • Photo of Michael Allen

    0

    If you pull up the details of your workflow after it has run, does the value of your "Body" attribute show valid JSON, or is it blank? I am wondering if that data is actually getting passed to the workflow correctly.

  • Photo of Dan Dietz

    0

    I'm not exactly sure where I see that. From the workflow entry list screen I can see the new entry after running my curl command. The entry is listed as "Not Yet Submitted" and "Active".

    If I look at the entry detail > Activities > Actions I see the "Set Name Webhook" action that I created as a Lava Run type. And it shows as completed.

    But entry detail > Details shows that the First Name has no value.

    I would love to see some JSON somewhere! I'm not sure where I should be looking to see that.


  • Photo of Dan Dietz

    0

    Michael, that was exactly the missing piece.

    You screenshots would be a nice addition to the docs here: https://community.rockrms.com/documentation/BookContent/12#webhooktoworkflow