Add a Push prompt to a container.

Add a Push prompt to a container.

POST https://api.ocamba.com/v1/hood/containers/{id}/push-prompts
Add a Push prompt to a container.

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/{id}/push-prompts" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "my prompt",
  "status": "active",
  "type": "native",
  "settings": {
    "onclick": true,
    "onscroll": false,
    "delay": null
  },
  "triggers": {
    "form_submission": true,
    "exit_intent": false,
    "visibility": true,
    "page_view": false,
    "scroll_depth": {
      "horizontal": {
        "percentage": 100
      },
      "enable_on": "window-load"
    },
    "timer": 60000,
    "custom_event": "onload",
    "require_all_triggers": true
  },
  "filters": [
    {
      "variable": "5647",
      "op": "not-starts-with",
      "value": "Some-value",
      "filters": [
        {
          "variable": "5645",
          "op": "eq",
          "value": "Some-value"
        }
      ]
    }
  ]
}'
const url = 'https://api.ocamba.com/v1/hood/containers/{id}/push-prompts';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "my prompt",
      "status": "active",
      "type": "native",
      "settings": {
        "onclick": true,
        "onscroll": false,
        "delay": null
      },
      "triggers": {
        "form_submission": true,
        "exit_intent": false,
        "visibility": true,
        "page_view": false,
        "scroll_depth": {
          "horizontal": {
            "percentage": 100
          },
          "enable_on": "window-load"
        },
        "timer": 60000,
        "custom_event": "onload",
        "require_all_triggers": true
      },
      "filters": [
        {
          "variable": "5647",
          "op": "not-starts-with",
          "value": "Some-value",
          "filters": [
            {
              "variable": "5645",
              "op": "eq",
              "value": "Some-value"
            }
          ]
        }
      ]
    }
  )
};

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/{id}/push-prompts");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "my prompt",
    "status" => "active",
    "type" => "native",
    "settings" => [
      "onclick" => true,
      "onscroll" => false,
      "delay" => null
    ],
    "triggers" => [
      "form_submission" => true,
      "exit_intent" => false,
      "visibility" => true,
      "page_view" => false,
      "scroll_depth" => [
        "horizontal" => [
          "percentage" => 100
        ],
        "enable_on" => "window-load"
      ],
      "timer" => 60000,
      "custom_event" => "onload",
      "require_all_triggers" => true
    ],
    "filters" => [
      [
        "variable" => "5647",
        "op" => "not-starts-with",
        "value" => "Some-value",
        "filters" => [
          [
            "variable" => "5645",
            "op" => "eq",
            "value" => "Some-value"
          ]
        ]
      ]
    ]
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

Responses

201 Created

{
  "id": "1000091",
  "company_id": "6197120",
  "container_id": "42027",
  "status": "active",
  "type": "custom-code",
  "name": "my push prompt",
  "triggers": {
    "consent_initiation": false,
    "page_view": false,
    "visibility": true,
    "scroll_depth": {
      "horizontal": {
        "percentage": 100
      },
      "enable_on": "window-load"
    },
    "form_submission": true,
    "exit_intent": false,
    "timer": 60000,
    "custom_event": "onload",
    "require_all_triggers": true,
    "delay": 0
  },
  "filters": [
    {
      "variable": "5647",
      "op": "not-starts-with",
      "value": "Some-value",
      "filters": [
        {
          "variable": "5645",
          "op": "eq",
          "value": "Some-value"
        }
      ]
    }
  ],
  "settings": {
    "onclick": true,
    "onscroll": false,
    "delay": null
  },
  "position": 7,
  "deleted": 0
}

400 Bad Request

{
  "code": 400,
  "title": "Bad request.",
  "message": "The request body 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