Hi @Sebastian,
I am facing two Issues with Asset Change Webhook{Rules} in squidex for populating Algolia Index
-
The response comes ‘Ignored’ after pushing to Algolia for any asset event type. No records get created in Algolia for asset change/creation/updation/annotation
-
What is the syntax for actually pushing an Image(the image itself in Algolia e.g. for Thumbnails)
Script(JSON.stringify(
{
“objectID”: ${ASSET_ID}
,
“img_url”: ${ASSET_URL}
,
“img”: ${asset.data}
,
}
))
PFA screenshots
Logs from Asset Change Webhook
No Records Available in Algolia
I couldn’t find much documentation on how to use assets within a given content event and otherwise. Please can you point to an example where I can refer
Algolia integration only listens to content events. I don’t remember why, probably because it was before you were able to customize the payload format.
@Sebastian. Thanks looking forward to use asset change updates. I also wanted to check if in one Schema Update can I load up assets data like slug and actual image.
UseCase
On Article change, I also want to push the Asset Content i.e image as thumbnail and the image url in Algolia Search Index
E.g. in Articles Schema I have a field to capture images of the article. While showing search results I want to be able to access the image as thumbnails hence need the image url data as well in the search index. For that I will have to push last associated image in Article Content change.
I will deploy this beginning of next week, tuesday or wednesday.
I can also allow resolving assets, but this is only possible with liquid template syntax (an alternative to scripts), a documentation about this will come soon, a collaborator promised me to provide something.
The reason is a technical limitation of the script engine, which does not exist in the template engine.
Here is an example of a liquid template just to give you a first impression
{
"Employee Name" : "{{ content.FirstName }} {{ content.LastName }}",
"Company Name" : "{{ content.Company }}",
"Date Of Joining" : "{{ "now" | Date: "MM/dd/yyyy" }}",
"Department" : "{{ content.department }}",
"Technology" : "{{ content.Work | Size }}",
"Skills" : [
{% for Skill in content.Work %}
{
"Name" : "{{ Skill.skil }}",
"Marks" : {{ Skill.Mark }}
},
{% endfor %}
]
}
It is NOT for Squidex event types, I took it from https://social.technet.microsoft.com/wiki/contents/articles/51275.microsoft-azure-liquid-templates-in-logic-apps.aspx
Products like Auth0 also use liquid syntax for similar usecases when customizing emails for user signups
Yes, liquid is already supported, but not documented.
Hi @Sebastian
Has this been deployed? Also you mentioned about a link for documentation around the liquid templating system.
Thanks
Sagun
Not yet, sorry…The documentation is promised to be by the co-author of the liquid system for this Friday.
1 Like
It has been deployed to the cloud now.
@Sebastian I tested the above by adding a new image to assets. Probably I am not using the right variables in payload? ASSET_URL and ASSET_DATA are both coming as undefined
Here is the payload I am triggering
Script(JSON.stringify(
{
"objectID": ASSET_ID,
"img_url": ASSET_URL,
"img": ASSET_DATA
}
))
At Algolia
I am getting undefined img_url and img
hi, the syntax just does not work.
It should be something like this:;
Script(JSON.stringify(
{
"objectID": event.id,
"img_url": assetContentUrl(),
// "img": ASSET_DATA <-- NOT SUPPORTED
}))
The objectId
is defined automatically, so you can just use
Script(JSON.stringify(
{
"img_url": assetContentUrl()
}))
1 Like