Add a Modal to a container

Add a Modal to a container

POST https://api.ocamba.com/v1/hood/containers/{container_id}/modals
Add a Modal to a container

Note
Please note that you cannot set finished as a status of the modal. Only ‘active’ or ‘inactive’ statuses can be set.

Rate limits:

  • Burst: 10/s
  • Steady: 150/m

Path parameters

parameters

Request schema

body

Response schemas

curl -X POST \
 "https://api.ocamba.com/v1/hood/containers/{container_id}/modals" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "status": "active",
  "type": "modal",
  "name": "Test Required",
  "settings": {
    "position": null,
    "background_color": "green",
    "height": null,
    "width": 500,
    "close_cta": null,
    "close_esc": null,
    "close_click": true,
    "close_auto": null,
    "delay": null,
    "animation": "fade-in"
  },
  "messages": [
    {
      "name": "message one",
      "content": {
        "en": "Message Content"
      },
      "settings": {
        "close_auto": 35000,
        "delay": 2000,
        "animation": "fade-in"
      }
    }
  ],
  "frequency": {
    "always_show": true,
    "stop_after_interaction": false,
    "per_session": null,
    "per_day": null,
    "per_week": null,
    "once_per_period": null,
    "show_cooldown": 5
  }
}'
const url = 'https://api.ocamba.com/v1/hood/containers/{container_id}/modals';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "status": "active",
      "type": "modal",
      "name": "Test Required",
      "settings": {
        "position": null,
        "background_color": "green",
        "height": null,
        "width": 500,
        "close_cta": null,
        "close_esc": null,
        "close_click": true,
        "close_auto": null,
        "delay": null,
        "animation": "fade-in"
      },
      "messages": [
        {
          "name": "message one",
          "content": {
            "en": "Message Content"
          },
          "settings": {
            "close_auto": 35000,
            "delay": 2000,
            "animation": "fade-in"
          }
        }
      ],
      "frequency": {
        "always_show": true,
        "stop_after_interaction": false,
        "per_session": null,
        "per_day": null,
        "per_week": null,
        "once_per_period": null,
        "show_cooldown": 5
      }
    }
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v1/hood/containers/{container_id}/modals");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "status" => "active",
    "type" => "modal",
    "name" => "Test Required",
    "settings" => [
      "position" => null,
      "background_color" => "green",
      "height" => null,
      "width" => 500,
      "close_cta" => null,
      "close_esc" => null,
      "close_click" => true,
      "close_auto" => null,
      "delay" => null,
      "animation" => "fade-in"
    ],
    "messages" => [
      [
        "name" => "message one",
        "content" => [
          "en" => "Message Content"
        ],
        "settings" => [
          "close_auto" => 35000,
          "delay" => 2000,
          "animation" => "fade-in"
        ]
      ]
    ],
    "frequency" => [
      "always_show" => true,
      "stop_after_interaction" => false,
      "per_session" => null,
      "per_day" => null,
      "per_week" => null,
      "once_per_period" => null,
      "show_cooldown" => 5
    ]
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl -X POST \
 "https://api.ocamba.com/v1/hood/containers/{container_id}/modals" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "status": "active",
  "type": "modal",
  "name": "Test Custom Modal",
  "triggers": {
    "consent_initiation": false,
    "page_load": false,
    "page_view": true,
    "scroll_depth": {
      "horizontal": {
        "percentage": 35
      },
      "vertical": {
        "pixels": 500
      }
    },
    "form_submission": true,
    "exit_intent": true,
    "timer": 1273,
    "custom_event": {
      "event": "load"
    },
    "require_all_triggers": false,
    "dom_content_ready": false
  },
  "settings": {
    "position": null,
    "background_color": "green",
    "height": null,
    "width": 500,
    "close_cta": null,
    "close_esc": null,
    "close_click": true,
    "close_auto": null,
    "delay": null,
    "animation": "fade-in"
  },
  "messages": [
    {
      "name": "message one",
      "content": {
        "en": "Message 1 Content"
      },
      "settings": {
        "close_auto": 35000,
        "delay": 2000,
        "animation": "fade-in"
      }
    },
    {
      "name": "message two",
      "content": {
        "en": "Message 2 Content"
      },
      "settings": {
        "background_color": "green",
        "animation": "bounce-in"
      }
    }
  ],
  "ab_test_config": {
    "num_of_appears": 6000,
    "evaluation_window": 48,
    "winning_metric": "click_rate",
    "winner_delivery_mode": "automatic"
  },
  "frequency": {
    "always_show": true,
    "stop_after_interaction": false,
    "per_session": null,
    "per_day": null,
    "per_week": null,
    "once_per_period": null,
    "show_cooldown": 5
  }
}'
const url = 'https://api.ocamba.com/v1/hood/containers/{container_id}/modals';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "status": "active",
      "type": "modal",
      "name": "Test Custom Modal",
      "triggers": {
        "consent_initiation": false,
        "page_load": false,
        "page_view": true,
        "scroll_depth": {
          "horizontal": {
            "percentage": 35
          },
          "vertical": {
            "pixels": 500
          }
        },
        "form_submission": true,
        "exit_intent": true,
        "timer": 1273,
        "custom_event": {
          "event": "load"
        },
        "require_all_triggers": false,
        "dom_content_ready": false
      },
      "settings": {
        "position": null,
        "background_color": "green",
        "height": null,
        "width": 500,
        "close_cta": null,
        "close_esc": null,
        "close_click": true,
        "close_auto": null,
        "delay": null,
        "animation": "fade-in"
      },
      "messages": [
        {
          "name": "message one",
          "content": {
            "en": "Message 1 Content"
          },
          "settings": {
            "close_auto": 35000,
            "delay": 2000,
            "animation": "fade-in"
          }
        },
        {
          "name": "message two",
          "content": {
            "en": "Message 2 Content"
          },
          "settings": {
            "background_color": "green",
            "animation": "bounce-in"
          }
        }
      ],
      "ab_test_config": {
        "num_of_appears": 6000,
        "evaluation_window": 48,
        "winning_metric": "click_rate",
        "winner_delivery_mode": "automatic"
      },
      "frequency": {
        "always_show": true,
        "stop_after_interaction": false,
        "per_session": null,
        "per_day": null,
        "per_week": null,
        "once_per_period": null,
        "show_cooldown": 5
      }
    }
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v1/hood/containers/{container_id}/modals");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "status" => "active",
    "type" => "modal",
    "name" => "Test Custom Modal",
    "triggers" => [
      "consent_initiation" => false,
      "page_load" => false,
      "page_view" => true,
      "scroll_depth" => [
        "horizontal" => [
          "percentage" => 35
        ],
        "vertical" => [
          "pixels" => 500
        ]
      ],
      "form_submission" => true,
      "exit_intent" => true,
      "timer" => 1273,
      "custom_event" => [
        "event" => "load"
      ],
      "require_all_triggers" => false,
      "dom_content_ready" => false
    ],
    "settings" => [
      "position" => null,
      "background_color" => "green",
      "height" => null,
      "width" => 500,
      "close_cta" => null,
      "close_esc" => null,
      "close_click" => true,
      "close_auto" => null,
      "delay" => null,
      "animation" => "fade-in"
    ],
    "messages" => [
      [
        "name" => "message one",
        "content" => [
          "en" => "Message 1 Content"
        ],
        "settings" => [
          "close_auto" => 35000,
          "delay" => 2000,
          "animation" => "fade-in"
        ]
      ],
      [
        "name" => "message two",
        "content" => [
          "en" => "Message 2 Content"
        ],
        "settings" => [
          "background_color" => "green",
          "animation" => "bounce-in"
        ]
      ]
    ],
    "ab_test_config" => [
      "num_of_appears" => 6000,
      "evaluation_window" => 48,
      "winning_metric" => "click_rate",
      "winner_delivery_mode" => "automatic"
    ],
    "frequency" => [
      "always_show" => true,
      "stop_after_interaction" => false,
      "per_session" => null,
      "per_day" => null,
      "per_week" => null,
      "once_per_period" => null,
      "show_cooldown" => 5
    ]
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl -X POST \
 "https://api.ocamba.com/v1/hood/containers/{container_id}/modals" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "status": "active",
  "name": "Test NPS Modal",
  "type": "nps",
  "impression_limit": 10000,
  "messages": [
    {
      "content": {
        "en": "<div id=\"modal\" style=\"display:flex;align-items:center;justify-content:center;position:relative;outline:0px;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;padding:20px\" data-close_cta=\"false\" data-close_click=\"true\" data-close_esc=\"true\" data-close_auto=\"false\" data-animation=\"slide-in\" data-delay=\"\"><div style=\"top:0px;left:0px;width:100%;position:fixed;opacity:0.3;background-color:rgb(0, 0, 0);z-index:0\"></div><div style=\"box-shadow:rgba(0, 0, 0, 0.2) 0px 0px 8px 2px;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;overflow-x:auto;overflow-y:auto;position:relative;z-index:1;max-width:768px;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;padding:20px;width:100%\"><div style=\"display:flex;width:100%;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;font-family:Roboto, sans-serif;justify-content:center;line-height:normal;padding:0px;text-align:start\"><button style=\"font-weight:700;padding-top:8px;padding-bottom:8px;border:none;border-radius:0px;background-color:rgb(53, 126, 221);color:rgb(255, 255, 255);font-size:16px\" id=\"pushShow\">Click me</button></div><div style=\"display:flex;width:100%;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;font-family:Roboto, sans-serif;justify-content:center;line-height:normal;padding:0px;text-align:start\"><button style=\"font-weight:700;padding-top:8px;padding-bottom:8px;border:none;border-radius:0px;background-color:rgb(53, 126, 221);color:rgb(255, 255, 255);font-size:16px\" id=\"pushShow\">Click here</button></div></div></div>"
      },
      "primary_lang": "en",
      "studio": [
        {
          "b": "canvas",
          "currentLang": "en",
          "currentlang": "en",
          "oc": "studio-modalcanvas",
          "properties": {
            "en": {
              "animation": "slide-in",
              "closetype": "close_esc",
              "customStyle": {
                "root": {
                  "styles": {
                    "background-color": "#ffffff",
                    "border-color": "#000000",
                    "border-radius": "0px",
                    "border-width": "0px",
                    "borderStyle": "none",
                    "padding-bottom": "20px",
                    "padding-left": "20px",
                    "padding-right": "20px",
                    "padding-top": "20px",
                    "width": "100"
                  }
                }
              }
            }
          },
          "property": "modalcanvasproperty",
          "zones": [
            {
              "items": [
                {
                  "b": "c",
                  "currentLang": "en",
                  "currentlang": "en",
                  "direction": "column",
                  "name": "Spacer",
                  "oc": "studio-spacer",
                  "properties": {
                    "en": {
                      "direction": "vertical"
                    }
                  }
                },
                {
                  "currentLang": "en",
                  "currentlang": "en",
                  "description": "Clickable buttons for actions and interactions",
                  "help": "",
                  "name": "Button",
                  "oc": "studio-button",
                  "properties": {
                    "en": {
                      "cta": "pushShow",
                      "customStyle": {
                        "button": {
                          "styles": {
                            "background-color": "#357edd",
                            "color": "#ffff",
                            "font-size": "16px"
                          }
                        },
                        "root": {
                          "styles": {
                            "background-color": "#ffff",
                            "border-color": "#000000",
                            "border-radius": "0px",
                            "border-width": "0px",
                            "borderStyle": "none",
                            "font-family": "Roboto, sans-serif",
                            "justify-content": "center",
                            "line-height": "normal",
                            "padding-bottom": "0px",
                            "padding-left": "0px",
                            "padding-right": "0px",
                            "padding-top": "0px",
                            "text-align": "start"
                          }
                        }
                      },
                      "label": "Click me",
                      "preset": "pill",
                      "type": "p"
                    }
                  },
                  "property": "buttonproperty",
                  "style": {
                    "icon": {
                      "classes": "fa-square"
                    },
                    "iconbox": {
                      "styles": {
                        "background": "#8b5cf6"
                      }
                    }
                  },
                  "tutorial": ""
                },
                {
                  "b": "c",
                  "currentLang": "en",
                  "currentlang": "en",
                  "direction": "column",
                  "name": "Spacer",
                  "oc": "studio-spacer",
                  "properties": {
                    "en": {
                      "direction": "vertical"
                    }
                  }
                },
                {
                  "currentLang": "en",
                  "currentlang": "en",
                  "description": "Clickable buttons for actions and interactions",
                  "help": "",
                  "name": "Button",
                  "oc": "studio-button",
                  "properties": {
                    "en": {
                      "cta": "pushShow",
                      "customStyle": {
                        "button": {
                          "styles": {
                            "background-color": "#357edd",
                            "color": "#ffff",
                            "font-size": "16px"
                          }
                        },
                        "root": {
                          "styles": {
                            "background-color": "#ffff",
                            "border-color": "#000000",
                            "border-radius": "0px",
                            "border-width": "0px",
                            "borderStyle": "none",
                            "font-family": "Roboto, sans-serif",
                            "justify-content": "center",
                            "line-height": "normal",
                            "padding-bottom": "0px",
                            "padding-left": "0px",
                            "padding-right": "0px",
                            "padding-top": "0px",
                            "text-align": "start"
                          }
                        }
                      },
                      "label": "Click here",
                      "preset": "pill",
                      "type": "p"
                    }
                  },
                  "property": "buttonproperty",
                  "style": {
                    "icon": {
                      "classes": "fa-square"
                    },
                    "iconbox": {
                      "styles": {
                        "background": "#8b5cf6"
                      }
                    }
                  },
                  "tutorial": ""
                },
                {
                  "b": "c",
                  "currentLang": "en",
                  "currentlang": "en",
                  "direction": "column",
                  "name": "Spacer",
                  "oc": "studio-spacer",
                  "properties": {
                    "en": {
                      "direction": "vertical"
                    }
                  }
                }
              ],
              "ref": "body"
            }
          ]
        }
      ],
      "name": "Template 176062438448734",
      "template_id": "2159"
    }
  ]
}'
const url = 'https://api.ocamba.com/v1/hood/containers/{container_id}/modals';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "status": "active",
      "name": "Test NPS Modal",
      "type": "nps",
      "impression_limit": 10000,
      "messages": [
        {
          "content": {
            "en": "<div id=\"modal\" style=\"display:flex;align-items:center;justify-content:center;position:relative;outline:0px;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;padding:20px\" data-close_cta=\"false\" data-close_click=\"true\" data-close_esc=\"true\" data-close_auto=\"false\" data-animation=\"slide-in\" data-delay=\"\"><div style=\"top:0px;left:0px;width:100%;position:fixed;opacity:0.3;background-color:rgb(0, 0, 0);z-index:0\"></div><div style=\"box-shadow:rgba(0, 0, 0, 0.2) 0px 0px 8px 2px;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;overflow-x:auto;overflow-y:auto;position:relative;z-index:1;max-width:768px;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;padding:20px;width:100%\"><div style=\"display:flex;width:100%;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;font-family:Roboto, sans-serif;justify-content:center;line-height:normal;padding:0px;text-align:start\"><button style=\"font-weight:700;padding-top:8px;padding-bottom:8px;border:none;border-radius:0px;background-color:rgb(53, 126, 221);color:rgb(255, 255, 255);font-size:16px\" id=\"pushShow\">Click me</button></div><div style=\"display:flex;width:100%;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;font-family:Roboto, sans-serif;justify-content:center;line-height:normal;padding:0px;text-align:start\"><button style=\"font-weight:700;padding-top:8px;padding-bottom:8px;border:none;border-radius:0px;background-color:rgb(53, 126, 221);color:rgb(255, 255, 255);font-size:16px\" id=\"pushShow\">Click here</button></div></div></div>"
          },
          "primary_lang": "en",
          "studio": [
            {
              "b": "canvas",
              "currentLang": "en",
              "currentlang": "en",
              "oc": "studio-modalcanvas",
              "properties": {
                "en": {
                  "animation": "slide-in",
                  "closetype": "close_esc",
                  "customStyle": {
                    "root": {
                      "styles": {
                        "background-color": "#ffffff",
                        "border-color": "#000000",
                        "border-radius": "0px",
                        "border-width": "0px",
                        "borderStyle": "none",
                        "padding-bottom": "20px",
                        "padding-left": "20px",
                        "padding-right": "20px",
                        "padding-top": "20px",
                        "width": "100"
                      }
                    }
                  }
                }
              },
              "property": "modalcanvasproperty",
              "zones": [
                {
                  "items": [
                    {
                      "b": "c",
                      "currentLang": "en",
                      "currentlang": "en",
                      "direction": "column",
                      "name": "Spacer",
                      "oc": "studio-spacer",
                      "properties": {
                        "en": {
                          "direction": "vertical"
                        }
                      }
                    },
                    {
                      "currentLang": "en",
                      "currentlang": "en",
                      "description": "Clickable buttons for actions and interactions",
                      "help": "",
                      "name": "Button",
                      "oc": "studio-button",
                      "properties": {
                        "en": {
                          "cta": "pushShow",
                          "customStyle": {
                            "button": {
                              "styles": {
                                "background-color": "#357edd",
                                "color": "#ffff",
                                "font-size": "16px"
                              }
                            },
                            "root": {
                              "styles": {
                                "background-color": "#ffff",
                                "border-color": "#000000",
                                "border-radius": "0px",
                                "border-width": "0px",
                                "borderStyle": "none",
                                "font-family": "Roboto, sans-serif",
                                "justify-content": "center",
                                "line-height": "normal",
                                "padding-bottom": "0px",
                                "padding-left": "0px",
                                "padding-right": "0px",
                                "padding-top": "0px",
                                "text-align": "start"
                              }
                            }
                          },
                          "label": "Click me",
                          "preset": "pill",
                          "type": "p"
                        }
                      },
                      "property": "buttonproperty",
                      "style": {
                        "icon": {
                          "classes": "fa-square"
                        },
                        "iconbox": {
                          "styles": {
                            "background": "#8b5cf6"
                          }
                        }
                      },
                      "tutorial": ""
                    },
                    {
                      "b": "c",
                      "currentLang": "en",
                      "currentlang": "en",
                      "direction": "column",
                      "name": "Spacer",
                      "oc": "studio-spacer",
                      "properties": {
                        "en": {
                          "direction": "vertical"
                        }
                      }
                    },
                    {
                      "currentLang": "en",
                      "currentlang": "en",
                      "description": "Clickable buttons for actions and interactions",
                      "help": "",
                      "name": "Button",
                      "oc": "studio-button",
                      "properties": {
                        "en": {
                          "cta": "pushShow",
                          "customStyle": {
                            "button": {
                              "styles": {
                                "background-color": "#357edd",
                                "color": "#ffff",
                                "font-size": "16px"
                              }
                            },
                            "root": {
                              "styles": {
                                "background-color": "#ffff",
                                "border-color": "#000000",
                                "border-radius": "0px",
                                "border-width": "0px",
                                "borderStyle": "none",
                                "font-family": "Roboto, sans-serif",
                                "justify-content": "center",
                                "line-height": "normal",
                                "padding-bottom": "0px",
                                "padding-left": "0px",
                                "padding-right": "0px",
                                "padding-top": "0px",
                                "text-align": "start"
                              }
                            }
                          },
                          "label": "Click here",
                          "preset": "pill",
                          "type": "p"
                        }
                      },
                      "property": "buttonproperty",
                      "style": {
                        "icon": {
                          "classes": "fa-square"
                        },
                        "iconbox": {
                          "styles": {
                            "background": "#8b5cf6"
                          }
                        }
                      },
                      "tutorial": ""
                    },
                    {
                      "b": "c",
                      "currentLang": "en",
                      "currentlang": "en",
                      "direction": "column",
                      "name": "Spacer",
                      "oc": "studio-spacer",
                      "properties": {
                        "en": {
                          "direction": "vertical"
                        }
                      }
                    }
                  ],
                  "ref": "body"
                }
              ]
            }
          ],
          "name": "Template 176062438448734",
          "template_id": "2159"
        }
      ]
    }
  )
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
$ch = curl_init("https://api.ocamba.com/v1/hood/containers/{container_id}/modals");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "status" => "active",
    "name" => "Test NPS Modal",
    "type" => "nps",
    "impression_limit" => 10000,
    "messages" => [
      [
        "content" => [
          "en" => "<div id=\"modal\" style=\"display:flex;align-items:center;justify-content:center;position:relative;outline:0px;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;padding:20px\" data-close_cta=\"false\" data-close_click=\"true\" data-close_esc=\"true\" data-close_auto=\"false\" data-animation=\"slide-in\" data-delay=\"\"><div style=\"top:0px;left:0px;width:100%;position:fixed;opacity:0.3;background-color:rgb(0, 0, 0);z-index:0\"></div><div style=\"box-shadow:rgba(0, 0, 0, 0.2) 0px 0px 8px 2px;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;overflow-x:auto;overflow-y:auto;position:relative;z-index:1;max-width:768px;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;padding:20px;width:100%\"><div style=\"display:flex;width:100%;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;font-family:Roboto, sans-serif;justify-content:center;line-height:normal;padding:0px;text-align:start\"><button style=\"font-weight:700;padding-top:8px;padding-bottom:8px;border:none;border-radius:0px;background-color:rgb(53, 126, 221);color:rgb(255, 255, 255);font-size:16px\" id=\"pushShow\">Click me</button></div><div style=\"display:flex;width:100%;background-color:rgb(255, 255, 255);border-color:rgb(0, 0, 0);border-radius:0px;border-width:0px;border-style:none;font-family:Roboto, sans-serif;justify-content:center;line-height:normal;padding:0px;text-align:start\"><button style=\"font-weight:700;padding-top:8px;padding-bottom:8px;border:none;border-radius:0px;background-color:rgb(53, 126, 221);color:rgb(255, 255, 255);font-size:16px\" id=\"pushShow\">Click here</button></div></div></div>"
        ],
        "primary_lang" => "en",
        "studio" => [
          [
            "b" => "canvas",
            "currentLang" => "en",
            "currentlang" => "en",
            "oc" => "studio-modalcanvas",
            "properties" => [
              "en" => [
                "animation" => "slide-in",
                "closetype" => "close_esc",
                "customStyle" => [
                  "root" => [
                    "styles" => [
                      "background-color" => "#ffffff",
                      "border-color" => "#000000",
                      "border-radius" => "0px",
                      "border-width" => "0px",
                      "borderStyle" => "none",
                      "padding-bottom" => "20px",
                      "padding-left" => "20px",
                      "padding-right" => "20px",
                      "padding-top" => "20px",
                      "width" => "100"
                    ]
                  ]
                ]
              ]
            ],
            "property" => "modalcanvasproperty",
            "zones" => [
              [
                "items" => [
                  [
                    "b" => "c",
                    "currentLang" => "en",
                    "currentlang" => "en",
                    "direction" => "column",
                    "name" => "Spacer",
                    "oc" => "studio-spacer",
                    "properties" => [
                      "en" => [
                        "direction" => "vertical"
                      ]
                    ]
                  ],
                  [
                    "currentLang" => "en",
                    "currentlang" => "en",
                    "description" => "Clickable buttons for actions and interactions",
                    "help" => "",
                    "name" => "Button",
                    "oc" => "studio-button",
                    "properties" => [
                      "en" => [
                        "cta" => "pushShow",
                        "customStyle" => [
                          "button" => [
                            "styles" => [
                              "background-color" => "#357edd",
                              "color" => "#ffff",
                              "font-size" => "16px"
                            ]
                          ],
                          "root" => [
                            "styles" => [
                              "background-color" => "#ffff",
                              "border-color" => "#000000",
                              "border-radius" => "0px",
                              "border-width" => "0px",
                              "borderStyle" => "none",
                              "font-family" => "Roboto, sans-serif",
                              "justify-content" => "center",
                              "line-height" => "normal",
                              "padding-bottom" => "0px",
                              "padding-left" => "0px",
                              "padding-right" => "0px",
                              "padding-top" => "0px",
                              "text-align" => "start"
                            ]
                          ]
                        ],
                        "label" => "Click me",
                        "preset" => "pill",
                        "type" => "p"
                      ]
                    ],
                    "property" => "buttonproperty",
                    "style" => [
                      "icon" => [
                        "classes" => "fa-square"
                      ],
                      "iconbox" => [
                        "styles" => [
                          "background" => "#8b5cf6"
                        ]
                      ]
                    ],
                    "tutorial" => ""
                  ],
                  [
                    "b" => "c",
                    "currentLang" => "en",
                    "currentlang" => "en",
                    "direction" => "column",
                    "name" => "Spacer",
                    "oc" => "studio-spacer",
                    "properties" => [
                      "en" => [
                        "direction" => "vertical"
                      ]
                    ]
                  ],
                  [
                    "currentLang" => "en",
                    "currentlang" => "en",
                    "description" => "Clickable buttons for actions and interactions",
                    "help" => "",
                    "name" => "Button",
                    "oc" => "studio-button",
                    "properties" => [
                      "en" => [
                        "cta" => "pushShow",
                        "customStyle" => [
                          "button" => [
                            "styles" => [
                              "background-color" => "#357edd",
                              "color" => "#ffff",
                              "font-size" => "16px"
                            ]
                          ],
                          "root" => [
                            "styles" => [
                              "background-color" => "#ffff",
                              "border-color" => "#000000",
                              "border-radius" => "0px",
                              "border-width" => "0px",
                              "borderStyle" => "none",
                              "font-family" => "Roboto, sans-serif",
                              "justify-content" => "center",
                              "line-height" => "normal",
                              "padding-bottom" => "0px",
                              "padding-left" => "0px",
                              "padding-right" => "0px",
                              "padding-top" => "0px",
                              "text-align" => "start"
                            ]
                          ]
                        ],
                        "label" => "Click here",
                        "preset" => "pill",
                        "type" => "p"
                      ]
                    ],
                    "property" => "buttonproperty",
                    "style" => [
                      "icon" => [
                        "classes" => "fa-square"
                      ],
                      "iconbox" => [
                        "styles" => [
                          "background" => "#8b5cf6"
                        ]
                      ]
                    ],
                    "tutorial" => ""
                  ],
                  [
                    "b" => "c",
                    "currentLang" => "en",
                    "currentlang" => "en",
                    "direction" => "column",
                    "name" => "Spacer",
                    "oc" => "studio-spacer",
                    "properties" => [
                      "en" => [
                        "direction" => "vertical"
                      ]
                    ]
                  ]
                ],
                "ref" => "body"
              ]
            ]
          ]
        ],
        "name" => "Template 176062438448734",
        "template_id" => "2159"
      ]
    ]
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

Responses

201 Created

{
  "id": "1030585",
  "company_id": "6197120",
  "container_id": "59389",
  "status": "active",
  "type": "nps",
  "name": "Test Custom Modal",
  "settings": {
    "position": "center-center",
    "background_color": "green",
    "height": 700,
    "width": 500,
    "close_cta": false,
    "close_esc": true,
    "close_click": true,
    "close_auto": 0,
    "delay": 0,
    "animation": "fade-in"
  },
  "frequency": {
    "always_show": true,
    "stop_after_interaction": false,
    "show_cooldown": 5
  },
  "messages": [
    {
      "id": "1004587",
      "company_id": "6197120",
      "container_id": "59389",
      "resource": "modal",
      "resource_id": "1030585",
      "experiment_id": "0",
      "template_id": null,
      "name": "message one",
      "content": {
        "en": "Message 1 Content"
      },
      "settings": {
        "position": "center-center",
        "background_color": "blue",
        "height": 700,
        "width": 500,
        "close_cta": false,
        "close_esc": true,
        "close_click": true,
        "close_auto": 35000,
        "delay": 2000,
        "animation": "fade-in"
      },
      "variant": "A",
      "winner": 0,
      "deleted": 0
    }
  ],
  "position": 1,
  "deleted": 0
}

400 Bad Request

{
  "code": 400,
  "title": "Bad request.",
  "message": "The request is not valid.",
  "trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}

500 Internal Server Error

{
  "code": 500,
  "title": "Internal server error.",
  "trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}
Responses