Is there an API call to edit message variables?

Hey!

Is there any possibility to edit message variables with the API (v2/v3)? I only saw the message_edit call, which edits a whole message.

We plan to send recurring campaigns containing our newest products. They are used in a couple of messages, so I think message variables are the way to go. Unfortunately, it seems they cannot be edited with the API?

Thanks and best regards
Florian

1 Like

Hey @florianbuettner,

I think you want the contact_sync API call, it will let you edit a contact’s custom fields - https://www.activecampaign.com/api/example.php?call=contact_sync

contact_sync is like combining a contact_view call to check if a contact exist and then either a contact_add or contact_edit call depending on the result.

Hey @jskole,

thanks for your reply. I was referring to Message Variables (https://help.activecampaign.com/hc/en-us/articles/115001124804-Message-Variables), a function to build custom code snippets, that I can use in multiple campaigns.

For example, I could build the Message Variable %newproducts% with custom html containing pictures, links and texts of our newest product. Since the new products change every week, I would like to update the message variable with the API.

If I understand you correctly, you suggest using custom fields of my contacts and store the product-html in there? I’m not sure if this would be meaningful, because we would have to update every contact’s custom field before sending the new campaign.

Ahhhh, I’m sorry yes I understand what you are trying to do now.

So what I would take a look at instead is fetch at send.

Then you can build out a dynamic page that renders the html for the email at time of send. You can even include personalization tags in the URL if you want to make the dynamic page really dynamic.

Matt has an old write-up on the feature that can be helpful.

If you want to use message variables you certainly can, you use them the same way that you would use a personalization tag, in an HTML email builder. Instead of replacing the personalization tag with a string, it will replace the message variable with the HTML block you built in the message variable area.

This is a fine way to do things, you just need to make sure to edit the message variable manually every week as products change.

Hey @jskole ,

ah, that sounds interesting! Thanks a lot!

But do I understand this right – I can only use this in combination with “full-html” mails, not with the email designer? We would love to fetch just one part of the mail via URL, for example in combination with the “custom html” content box.

Alas yes, if you use fetch at send you will need to render the entire email :frowning: