• Hello,

    I am experiencing an issue with integrating data received from a webhook into a WordPress post. Specifically, the text contains double backslashes, such as \\[\\frac{\\partial f}{\\partial x}\\], but these backslashes are being treated as regular slashes. As a result, in the WordPress editor, the output appears as rac{artial f}{artial x} instead of the correct format \[\frac{\partial f}{\partial x}\].

    I have reviewed the UA logs and confirmed that the data is received correctly (with double backslashes), and the content appears correctly published (with single backslashes). However, when viewing it in the WordPress editor, the backslashes are removed, along with the first letter following each backslash.

    Could you please advise if there is a way to resolve this issue? I would greatly appreciate any guidance or assistance you can provide.

    Thank you very much for your help!

    • This topic was modified 2 months, 1 week ago by disilbax.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Uncanny Automator

    (@uncannyautomator)

    Hi @disilbax ,

    Sorry to hear about the challenges.

    We explored this with our dev team and they wondered if you could possibly provide a sample of the full data set (maybe cross out anything sensitive) for their review. It would also help if you could go to the list of all Automator recipes, hover over the recipe in question here, then click the Export link. It would really help if we could see the JSON file. You could post a link to it here or send it to us via our website.

    Thanks

    Thread Starter disilbax

    (@disilbax)

    Thank you for your answer.

    Let me show you an example of what I see when I go to the recipe logs :

    • Response Body json is :
    {

    ? "candidates": [

    ? ? {

    ? ? ? "content": {

    ? ? ? ? "parts": [

    ? ? ? ? ? {

    ? ? ? ? ? ? "text": "\n$$Delta = b^2 - 4ac = (-5)^2 - 4 \\times 2 \\times 2 = 25 - 16 = 9$$\n\n"

    ? ? ? ? ? }

    ? ? ? ? ],

    ? ? ? ? "role": "model"

    ? ? ? },

    ? ? ? "finishReason": "STOP",

    ? ? ? "index": 0

    ? ? }

    ? ]

    }
    • And then, also in UA logs, the page content is :

    $$Delta = b^2 – 4ac = (-5)^2 – 4 \times 2 \times 2 = 25 – 16 = 9$$

    Now, when I go to the wordpress post editor to see the created page, I see that :

    $$Delta = b^2 – 4ac = (-5)^2 – 4 ? imes 2 ? imes 2 = 25 – 16 = 9$$

    I also see that everything beetween <> is also removed from created posts. So for example if I have “if x < 0, then… and if x > 0″, everything beetween <> (here ” 0, then… and if x “) is eliminated.

    I think the problem is that something is kind of sanitizing the text.

    Plugin Contributor Uncanny Automator

    (@uncannyautomator)

    Hi @disilbax, thanks for the update.

    You mentioned that when you view the published post after it’s created by Automator, it looks fine, but when you open it in the WordPress editor, that’s when the issue appears. So it seems as though the sanitization is being applied by the editor.

    I’m not sure that’s an issue we can resolve, but perhaps you could tell us what editor you’re using. Could you also try a different editor to see if that resolves the issue? For example, if you’re using the block editor, try the classic editor, and vice versa?

    Thread Starter disilbax

    (@disilbax)

    It does not work with any of the editors (classic or block).

    I am sure that UA is sanitizing. It’s not WP.

    Try to do the following :
    1. Create a recipe that include create post action.

    2. In the content of the post, add :

    \[\frac{\partial f}{\partial x}\]
    \\[\\frac{\\partial f}{\\partial x}\\]
    \\\[\\\frac{\\\partial f}{\\\partial x}\\\]

    3. Save the action and refresh the page. Open again the action that you have created just before to edit it. You’ll see that all the \ have gone.
    Try the same for something with <>. So when the post is published, something is sanitizing before even creating the post.

    Also, when I view the published post after it’s created by Automator, it does not look fine. The logs look fine but not the content.

    Plugin Contributor Uncanny Automator

    (@uncannyautomator)

    Hi @disilbax, got it…thanks for clarifying! I misunderstood your original message.

    Since incoming webhooks are a Pro feature and in case we need additional site-specific information to troubleshoot, can you please open a ticket from your account page? https://automatorplugin.com/my-account/tickets/ You can also send an email to [email protected] if that’s easier. ??

    I’ll keep an eye out for it and make sure it gets assigned a developer as soon as it comes in.

    Thread Starter disilbax

    (@disilbax)

    It is not a pro feature. Let me explain. (Sorry English is not my first langage, maybe that’s why we are not understanding each other) :

    I am sending data to a webhook (which is not a pro feature as far as I know) and I am using the content of the response to create a post. Also, the response contains text with mathematicals formulas.

    Anyway, as I said in my previous message, even if you are not sending data to a webhook and you are just trying to create a post with text containing \ or <>, those elements would be eliminated. So that is the problem.

    Plugin Contributor Uncanny Automator

    (@uncannyautomator)

    Hi @disilbax, got it. I understand completely now. Sorry for the back and forth!

    Being able to use the content of a webhook response in a recipe is a feature of Uncanny Automator that I think is really great…and using the webhook response to create a post is quite a clever usage of that feature!

    I’ve assigned our developer to take a look at the JSON you provided earlier and I hope he can come up with a solution for you tomorrow. If we need any additional info I’ll reach out here.

    Plugin Contributor Uncanny Automator

    (@uncannyautomator)

    Hi @disilbax, thanks for your patience. We’ve added a filter that should give you the results you’re looking for. That update will be available for download later today (version 5.10.2).

    Once you’ve installed that update, you’ll need to add this snippet to your theme’s functions.php file:

    add_filter( 'automator_wpcpostcontent_should_wp_slash', function( $data ) { return true; } );

    Then give it a try and let us know if it works!

    Thread Starter disilbax

    (@disilbax)

    Thank you for your help, but unfortunatly, it’s still does not work. Slashes are still eliminated.

    Could you try yourself ?

    Try to automatize the creation of a post with :

    \[\frac{\partial f}{\partial x}\]
    \\[\\frac{\\partial f}{\\partial x}\\]
    \\\[\\\frac{\\\partial f}{\\\partial x}\\\]

    anf if x<0 and y>4, then….

    Try to publish this content in the content of the post or any meta like excerpt or title.

    Plugin Contributor Uncanny Automator

    (@uncannyautomator)

    Hi @disilbax, thanks for the feedback. We discovered two other sections of code that required an update. They will be included in the next release, which does not yet have a scheduled date. Here they are if you want to start using them now:

    wp-content/plugins/uncanny-automator/src/core/lib/utilities/class-automator-input-parser.php

    wp-content/plugins/uncanny-automator/src/integrations/wp/actions/wp-createpost.php

    You’ll also need to use this updated snippet in your functions.php file:

    // 1. Fix in the recipe editor.
    add_filter(
    'automator_wpcpostcontent_should_wp_slash',
    function( $data ) {
    return true;
    }
    );

    // 2. Fix the parser.
    add_filter(
    'automator_parse_token_parse_text_autostripcslashes',
    function( $text ) {
    return false;
    }
    );

    // 2. Fix wp_insert_posts
    add_filter(
    'automator_create_posts_should_wpslash',
    function( $action_data ) {
    return true;
    }
    );

    Hope this update finally gets you up and running. Sorry for the inconvenience!

    Thread Starter disilbax

    (@disilbax)

    Thank you, I’ll try that and will get back to you.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.