The templating language we use in the platform, Jinja2, has a limitation when used with our web framework, Django. Due to the way Jinja2's attribute lookup system is designed, it decides not to ignore built-in functions that it should ignore. Because of this, there are some reserved keywords that we do not recommend using in the parsing rules.
In this article, we'll cover:
Keywords users should not include
Here, we will address the keywords users should not include in their Webhook Response parsing rules. Any path with the format "xxxx.yyy" that uses any of the reserved tokens below may present issues and should be avoided:
If you are already using these reserved tokens, then we recommend that you edit them and use the suggested format shown in the example below.
Consider a botbuilder who uses the following keywords in their parsing rules:
{
"marketplaceOrderState": "{{marketplaceOrderState}}",
"trackingNumber": "{{shipments[0].items[0].tracking[0].trackingNumber}}",
"handlingOrder1": "{{shipments[0].items[0].action}}"
}
There's nothing inherently wrong with the format used here, but because the customer is using the reserved token "items" in the path for extracting the Custom Variables, it results in no Custom Variables being created.
A solution to circumvent this issue
There is a way to circumvent this issue while using the reserved tokens, but it requires changing the format of the path used.
This is the format that we recommend when using the reserved tokens in the list above:
{
"trackingNumber": "{{shipments[0]['items'][0].tracking[0].trackingNumber}}",
"handlingOrder1": "{{{shipments[0]['items'][0].action}}",
"marketplaceOrderState": "{{marketplaceOrderState}}"
}