{"id":1010,"date":"2025-06-17T07:05:32","date_gmt":"2025-06-17T07:05:32","guid":{"rendered":"https:\/\/api-users.4over.com\/?page_id=1010"},"modified":"2025-06-17T16:16:52","modified_gmt":"2025-06-17T16:16:52","slug":"eddm-iframe-setup","status":"publish","type":"page","link":"https:\/\/api-users.4over.com\/?page_id=1010","title":{"rendered":"EDDM Iframe Setup"},"content":{"rendered":"<p>This guide contains real working examples, code snippets, and documentation for the EDDM Map. Using the EDDM map requires the following input data:<\/p>\n<p>-oAuth Access Token<\/p>\n<p>-Delivery Date<\/p>\n<p>-Product &#038; Option UUID&#8217;s<\/p>\n\n<h3>Obtain an oAuth Access Token<\/h3>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\nhttps:\/\/api.4over.com\/oauth\/v2\/token?client_id= + client_id + &amp;client_secret= + client_secret + &amp;grant_type=client_credentials\n<\/pre>\n\n<h3>Select your desired delivery date with the following API route:<\/h3>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\nhttps:\/\/api.4over.com\/dates?&amp;eddm=true&amp;access_token= + access_token\n<\/pre>\n\n<h3>Get EDDM product options:<\/h3>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\nhttps:\/\/api.4over.com\/printproducts\/products\/ + product_uuid + ?validators=true&amp;product_uuid= + product_uuid + &amp;access_token= + access_token\n<\/pre>\n\n<br>\n<h3>Add the map iFrame to your website:<\/h3>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;iframe id=&quot;eddmIframe&quot; src=&quot;https:\/\/EDDMeasy.com&quot; height=&quot;800&quot; width=&quot;100%&quot;&gt;&lt;\/iframe&gt;\n<\/pre>\n\n<h3>Start the EDDM Map<\/h3>\n<p>Start the EDDM Map using the HTML5 PostMessage API:<\/p>\n<p>Replace &#8216;ACCESS_TOKEN&#8217; of the javascript section with your generated oAuth token.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nvar domain = &#039;https:\/\/EDDMeasy.com&#039;;\nvar iframe = document.getElementById(&#039;eddmIframe&#039;).contentWindow;\n\nvar data = {\n  type: &#039;eddm_start&#039;,\n  access_token: ACCESS_TOKEN,\n  date: &#039;2025-12-30&#039;, \/\/ format: yyyy-mm-dd\n  product_uuid: ...,\n  product_options: ..., \/\/ format: &amp;options[]=UUID&amp;options[]=UUID...\n  map_event_data: ..., \/\/ optional: loads the map back to prexisting state based on selected routes\n  product_name: &#039;Custom Product Name&#039;, \/\/ optional\n  next_button_text: &#039;Custom Button Text&#039;, \/\/ optional\n  show_eddm_service_price: ..., \/\/ format: boolean\n  postage_markup_percentage: 0, \/\/ optional\n  product_markup_percentage: 0, \/\/ optional\n  \/\/ Markup EDDM service cost at any quantity\n  eddm_service_cost_smoothing: [{ &#039;250&#039;: 20 }, { &#039;325&#039;: 22 }, { &#039;475&#039;: 30 }, ...] \/\/ format: array of objects, optional: minimum runsize\/percentage markup\n  eddm_service_markup_percentage: 0, \/\/ format: number, optional: markup eddm service price by percentage,\n  show_outputted_map_data: ..., \/\/ format: boolean, optional: shows detailed map data with route coordinates\n};\n\niframe.postMessage(data, domain);\n<\/pre>\n\n<h3>Additional Post Message Options<\/h3>\n<p>Send these messages to update the map while its running.<\/p>\n<p>Update next button text:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nvar data = {\n\ttype: &#039;next_button_text_update&#039;,\n\tnext_button_text: &#039;Custom Button Text&#039;\n};\niframe.postMessage(data, domain);\n<\/pre>\n\n<h3>Events<\/h3>\n<p>Messages contain map data sent through HTML5 PostMessage API from the EDDM map. These messages contain all the necessary info needed to order the selected EDDM Map product.<\/p>\n<p>Listen to the native &#8216;message&#8217; event for output data coming from the EDDM Map:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nwindow.addEventListener(&#039;message&#039;, function(event) {\n\t\/\/ If &#039;message&#039; didn&#039;t come from the EDDM Map, do nothing\n\tif (event.origin !== (&#039;https:\/\/EDDMeasy.com&#039;)) { return; };\n\t\/\/ Do something with event.data\n\thandleMessage(event.data);\n});\n<\/pre>\n\n\n<ul class=\"wp-block-list\"><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This guide contains real working examples, code snippets, and documentation for the EDDM Map. Using the EDDM map requires the following input data: -oAuth Access Token -Delivery Date -Product &#038; Option UUID&#8217;s Obtain an oAuth Access Token Select your desired delivery date with the following API route: Get EDDM product options: Add the map iFrame [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1010","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/pages\/1010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/api-users.4over.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1010"}],"version-history":[{"count":11,"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/pages\/1010\/revisions"}],"predecessor-version":[{"id":1044,"href":"https:\/\/api-users.4over.com\/index.php?rest_route=\/wp\/v2\/pages\/1010\/revisions\/1044"}],"wp:attachment":[{"href":"https:\/\/api-users.4over.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}