Method Community

 

Remove/replace carriage returns

Last post 06-13-2018 10:05 AM by Method_Ben. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-12-2018 7:22 PM

    Remove/replace carriage returns

    I'm trying to use the Call Web Service action in combination with Zapier webhooks to send email using the Mandrill transactional email service. Everything is working except that the email message body, which the user can adjust in an HTML control on the Method screen, is being included in the JSON payload with carriage returns included, and Zapier can't interpret the payload correctly with them included. Is there some way I can force these to be stripped before sending the webhook? I was able to find info on the forums about how to replace newlines in Method Classic, but we've only been using Method for about 9 months and only use the new version of the site.

    I am already copying the email message body from the HTML control where it's created/edited to a second plain text field and escaping any double quotes and backspaces that may exist, but that doesn't remove the carriage returns. 

    I've used Webhook.site to inspect the actual JSON payload being sent, here's an example:

    { "subject": "Sample Subject Line", "body": "<p>Hello Name,</p>
    <p>Email body introduction.</p>
    <p>Here are the details:</p>
    <ul>
    <li>point 1</li>
    <li>point 2</li>
    <li>point 3</li>
    </ul>
    <p>Final Information goes here</p>
    <p>Thank You,&nbsp;</p>
    <p>Sender Name/Signature</p>", "sender_name": "Shannon Henry", "sender_email": "shannon@h***.com", "reply_to": "c***@h***.com", "JobID": "****", "recip_email": "shannon@h***.com", "check_param": "........."}
    If I take the payload from webhooks.site and remove the carriage returns from the "body" section, so it all shows on a single line, then paste that into the payload space in the Call Web Service - Test Environment, the automation triggers perfectly. But with the extra carriage returns in place I get a succcess message from Zapier but the automation does not actually trigger, as the service is unable to accurately parse the payload. 
  • 06-13-2018 10:05 AM In reply to

    Re: Remove/replace carriage returns

    Hi there,


    Thanks for posting!

    Out of curiosity - would you mind linking the forum post you mentioned which references Method Classic? Perhaps I can recommend a solution in Method:New based off that.

    How does the output look if you add a style tag to your elements before sending to the Call Web Service Action? ie - " <p style="display: inline-block;"> ". that should force the HTML to display on one line.



    Thanks

    -Ben

    Ben Hargreaves
    Senior Support Specialist
    Method:CRM
    b.hargreaves@method.me
    Toll Free: 1.888.925.6238
    Local & Overseas: 416.847.0400
    Fax: 416.640.6027
Page 1 of 1 (2 items)