XPath Support for Webhooks? | Community
Skip to main content
Casey_Grimes2
New Participant
June 13, 2016
Solved

XPath Support for Webhooks?

  • June 13, 2016
  • 3 replies
  • 3548 views

I'm really trying to avoid making a particular solution more complicated than it needs to be by using a webhook rather than an API to update some lead information that's being transmitted via XML. In this particular case, the structure looks something like

<level1>

    <level2>

        <level3>

            <apple_type>Gala</apple_type>

            <orange_type>Navel</orange_type>

        </level3>

    </level2>

</level1>

Nothing particularly rocket science is attempting to be accomplished here: all I'm trying to do is pull apple_type when orange_type is Navel. Normally with XPath I'd just do something like

/level1/level2/level3[orange_type/text() = "Navel"]/apple_type/text()

However, it doesn't seem like Marketo can use that sort of markup for a response. Because I have multiple potential level3 tags, I can't rely on just turning the query into something that can just look for the order of the tag. Is there any sort of recourse here or am I going to have to make this into a formal API call to place the apple_type data into a field?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Nothing like this can be done with native response processing AFAIK.  You could use Apigee (in contrast, AWS APIGW is bad at this) to transform the data if you didn't want to write your own transforming layer, but that might be more trouble than it's worth.

3 replies

June 14, 2016

I think you will have to write your own 'webhook' middle layer to extract appropriate information from the xml.

If you just want to display that information in an email, Velocity scripting might have some XPath functionality you can use.

Rajesh

Casey_Grimes2
New Participant
June 15, 2016

I actually wound up doing exactly that re:webhook middle layer (all praise to SimpleXML and json_encode!) but the idea of running an XPath selection through Velocity is intriguing—has anyone actually tried this? I'd think it slow the render/send of emails down a ton, but might be interesting in other use cases.

SanfordWhiteman
New Participant
June 15, 2016

Don't think XmlTool is in the Marketo deployment, is it?

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
June 13, 2016

Nothing like this can be done with native response processing AFAIK.  You could use Apigee (in contrast, AWS APIGW is bad at this) to transform the data if you didn't want to write your own transforming layer, but that might be more trouble than it's worth.

Grégoire_Miche2
New Participant
June 13, 2016

Hi Courtney,

Honestly, if YOU do not know the answer to this, who will ?? I don't.

-Greg