Create Push task

Create Push task

POST https://api.ocamba.com/v1/hood/push-tasks
Creates a new Push task object

Rate limits:

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

Request schema

body

Response schemas

curl -X POST \
 "https://api.ocamba.com/v1/hood/push-tasks" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Demo",
  "status": 1,
  "start_time": "immediately",
  "message": {
    "title": {
      "en": "Hello from Del Systems"
    },
    "body": {
      "en": "We are glad to introduce you to ocamba platform"
    },
    "image": {
      "en": "https://www.ocamba.com/images/logo.png"
    },
    "landing_url": "https://www.ocamba.com/",
    "actions": [
      {
        "action": null,
        "icon": null,
        "title": {
          "en": "Yes"
        },
        "url": "https://www.youtube.com/watch?v=123"
      },
      {
        "action": null,
        "icon": null,
        "title": {
          "en": "No"
        },
        "url": "https://www.youtube.com/watch?v=NO"
      }
    ]
  },
  "targeting": {
    "accounts": {
      "items": [
        "6197120"
      ],
      "op": "include"
    },
    "application_groups": {
      "items": [
        "1383"
      ],
      "op": "include"
    },
    "applications": {
      "items": [
        "www.ocamba.com"
      ],
      "op": "include"
    },
    "apps": {
      "items": [
        "21050"
      ],
      "op": "include"
    },
    "browsers": {
      "items": [
        "12"
      ],
      "op": "include"
    },
    "countries": {
      "items": [
        "CA"
      ],
      "op": "include"
    },
    "groups": {
      "items": [
        "481"
      ],
      "op": "include"
    },
    "languages": {
      "items": [
        "es"
      ],
      "op": "include"
    },
    "os": {
      "items": [
        "12"
      ],
      "op": "include"
    },
    "regions": {
      "items": [
        "2593109",
        "2525468"
      ],
      "op": "include"
    },
    "remote_users": {
      "items": [
        "Nesto Bilo Sta"
      ],
      "op": "include"
    },
    "segments": {
      "items": [
        "2817"
      ],
      "op": "include"
    },
    "subscribed_age": {
      "from": 1,
      "to": 2
    },
    "user_data": {
      "example1": {
        "items": [
          "AZ BZ"
        ],
        "op": "include"
      },
      "example2": {
        "items": [
          "Test"
        ],
        "op": "include"
      },
      "example3": {
        "items": [
          "Test"
        ],
        "op": "include"
      }
    },
    "users": {
      "items": [
        "123123121312312"
      ],
      "op": "include"
    }
  }
}'
const url = 'https://api.ocamba.com/v1/hood/push-tasks';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "Demo",
      "status": 1,
      "start_time": "immediately",
      "message": {
        "title": {
          "en": "Hello from Del Systems"
        },
        "body": {
          "en": "We are glad to introduce you to ocamba platform"
        },
        "image": {
          "en": "https://www.ocamba.com/images/logo.png"
        },
        "landing_url": "https://www.ocamba.com/",
        "actions": [
          {
            "action": null,
            "icon": null,
            "title": {
              "en": "Yes"
            },
            "url": "https://www.youtube.com/watch?v=123"
          },
          {
            "action": null,
            "icon": null,
            "title": {
              "en": "No"
            },
            "url": "https://www.youtube.com/watch?v=NO"
          }
        ]
      },
      "targeting": {
        "accounts": {
          "items": [
            "6197120"
          ],
          "op": "include"
        },
        "application_groups": {
          "items": [
            "1383"
          ],
          "op": "include"
        },
        "applications": {
          "items": [
            "www.ocamba.com"
          ],
          "op": "include"
        },
        "apps": {
          "items": [
            "21050"
          ],
          "op": "include"
        },
        "browsers": {
          "items": [
            "12"
          ],
          "op": "include"
        },
        "countries": {
          "items": [
            "CA"
          ],
          "op": "include"
        },
        "groups": {
          "items": [
            "481"
          ],
          "op": "include"
        },
        "languages": {
          "items": [
            "es"
          ],
          "op": "include"
        },
        "os": {
          "items": [
            "12"
          ],
          "op": "include"
        },
        "regions": {
          "items": [
            "2593109",
            "2525468"
          ],
          "op": "include"
        },
        "remote_users": {
          "items": [
            "Nesto Bilo Sta"
          ],
          "op": "include"
        },
        "segments": {
          "items": [
            "2817"
          ],
          "op": "include"
        },
        "subscribed_age": {
          "from": 1,
          "to": 2
        },
        "user_data": {
          "example1": {
            "items": [
              "AZ BZ"
            ],
            "op": "include"
          },
          "example2": {
            "items": [
              "Test"
            ],
            "op": "include"
          },
          "example3": {
            "items": [
              "Test"
            ],
            "op": "include"
          }
        },
        "users": {
          "items": [
            "123123121312312"
          ],
          "op": "include"
        }
      }
    }
  )
};

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/push-tasks");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "Demo",
    "status" => 1,
    "start_time" => "immediately",
    "message" => [
      "title" => [
        "en" => "Hello from Del Systems"
      ],
      "body" => [
        "en" => "We are glad to introduce you to ocamba platform"
      ],
      "image" => [
        "en" => "https://www.ocamba.com/images/logo.png"
      ],
      "landing_url" => "https://www.ocamba.com/",
      "actions" => [
        [
          "action" => null,
          "icon" => null,
          "title" => [
            "en" => "Yes"
          ],
          "url" => "https://www.youtube.com/watch?v=123"
        ],
        [
          "action" => null,
          "icon" => null,
          "title" => [
            "en" => "No"
          ],
          "url" => "https://www.youtube.com/watch?v=NO"
        ]
      ]
    ],
    "targeting" => [
      "accounts" => [
        "items" => [
          "6197120"
        ],
        "op" => "include"
      ],
      "application_groups" => [
        "items" => [
          "1383"
        ],
        "op" => "include"
      ],
      "applications" => [
        "items" => [
          "www.ocamba.com"
        ],
        "op" => "include"
      ],
      "apps" => [
        "items" => [
          "21050"
        ],
        "op" => "include"
      ],
      "browsers" => [
        "items" => [
          "12"
        ],
        "op" => "include"
      ],
      "countries" => [
        "items" => [
          "CA"
        ],
        "op" => "include"
      ],
      "groups" => [
        "items" => [
          "481"
        ],
        "op" => "include"
      ],
      "languages" => [
        "items" => [
          "es"
        ],
        "op" => "include"
      ],
      "os" => [
        "items" => [
          "12"
        ],
        "op" => "include"
      ],
      "regions" => [
        "items" => [
          "2593109",
          "2525468"
        ],
        "op" => "include"
      ],
      "remote_users" => [
        "items" => [
          "Nesto Bilo Sta"
        ],
        "op" => "include"
      ],
      "segments" => [
        "items" => [
          "2817"
        ],
        "op" => "include"
      ],
      "subscribed_age" => [
        "from" => 1,
        "to" => 2
      ],
      "user_data" => [
        "example1" => [
          "items" => [
            "AZ BZ"
          ],
          "op" => "include"
        ],
        "example2" => [
          "items" => [
            "Test"
          ],
          "op" => "include"
        ],
        "example3" => [
          "items" => [
            "Test"
          ],
          "op" => "include"
        ]
      ],
      "users" => [
        "items" => [
          "123123121312312"
        ],
        "op" => "include"
      ]
    ]
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl -X POST \
 "https://api.ocamba.com/v1/hood/push-tasks" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Demo",
  "status": 1,
  "start_time": "2022-01-01 12:00:00",
  "frequency": "3600",
  "message": {
    "title": {
      "en": "Hello from Del Systems"
    },
    "body": {
      "en": "We are glad to introduce you to ocamba platform"
    },
    "image": {
      "en": "https://www.ocamba.com/images/logo.png"
    },
    "landing_url": "https://www.ocamba.com/"
  }
}'
const url = 'https://api.ocamba.com/v1/hood/push-tasks';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "Demo",
      "status": 1,
      "start_time": "2022-01-01 12:00:00",
      "frequency": "3600",
      "message": {
        "title": {
          "en": "Hello from Del Systems"
        },
        "body": {
          "en": "We are glad to introduce you to ocamba platform"
        },
        "image": {
          "en": "https://www.ocamba.com/images/logo.png"
        },
        "landing_url": "https://www.ocamba.com/"
      }
    }
  )
};

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/push-tasks");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "Demo",
    "status" => 1,
    "start_time" => "2022-01-01 12:00:00",
    "frequency" => "3600",
    "message" => [
      "title" => [
        "en" => "Hello from Del Systems"
      ],
      "body" => [
        "en" => "We are glad to introduce you to ocamba platform"
      ],
      "image" => [
        "en" => "https://www.ocamba.com/images/logo.png"
      ],
      "landing_url" => "https://www.ocamba.com/"
    ]
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl -X POST \
 "https://api.ocamba.com/v1/hood/push-tasks" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Demo",
  "status": 1,
  "start_time": "immediately",
  "cron": "0 12 * * 1,5",
  "message": {
    "title": {
      "en": "Hello from Del Systems"
    },
    "body": {
      "en": "We are glad to introduce you to ocamba platform"
    },
    "image": {
      "en": "https://www.ocamba.com/images/logo.png"
    },
    "landing_url": "https://www.ocamba.com/"
  },
  "quiet_time": {
    "from": "0",
    "to": "4"
  }
}'
const url = 'https://api.ocamba.com/v1/hood/push-tasks';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "Demo",
      "status": 1,
      "start_time": "immediately",
      "cron": "0 12 * * 1,5",
      "message": {
        "title": {
          "en": "Hello from Del Systems"
        },
        "body": {
          "en": "We are glad to introduce you to ocamba platform"
        },
        "image": {
          "en": "https://www.ocamba.com/images/logo.png"
        },
        "landing_url": "https://www.ocamba.com/"
      },
      "quiet_time": {
        "from": "0",
        "to": "4"
      }
    }
  )
};

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/push-tasks");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "Demo",
    "status" => 1,
    "start_time" => "immediately",
    "cron" => "0 12 * * 1,5",
    "message" => [
      "title" => [
        "en" => "Hello from Del Systems"
      ],
      "body" => [
        "en" => "We are glad to introduce you to ocamba platform"
      ],
      "image" => [
        "en" => "https://www.ocamba.com/images/logo.png"
      ],
      "landing_url" => "https://www.ocamba.com/"
    ],
    "quiet_time" => [
      "from" => "0",
      "to" => "4"
    ]
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl -X POST \
 "https://api.ocamba.com/v1/hood/push-tasks" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Demo",
  "status": 1,
  "start_time": "immediately",
  "targeting": {
    "users": {
      "items": [
        "16601317995517219702"
      ],
      "op": "include"
    }
  },
  "adex": {
    "account_id": 123456,
    "campaign_id": [
      "1011086"
    ],
    "default_campaign_id": 1011086,
    "group_id": [
      "1723"
    ],
    "number_of_messages": 1,
    "repeat_on_click": 0,
    "zone_id": 3002371,
    "fallback_message": {
      "title": "Important Update Available",
      "body": "Please check your app for the latest updates and features.",
      "image": "https://example.com/images/notification-banner.jpg",
      "icon": "https://example.com/icons/app-icon.png",
      "landing_url": "https://example.com/landing/notification",
      "tag": "urgent-update",
      "require_interaction": "1",
      "renotify": "0",
      "silent": "0",
      "vibration": "100,100",
      "badge": "https://example.com/badges/notification-badge.png",
      "actions": [
        {
          "title": "View Details",
          "icon": "https://example.com/icons/action-icon.png",
          "url": "https://example.com/action/learn-more"
        },
        {
          "title": "Dismiss",
          "icon": null,
          "url": null
        }
      ]
    }
  },
  "ttl": "3600",
  "user_time_zone": "0",
  "total_user": "0",
  "frequency": "86400"
}'
const url = 'https://api.ocamba.com/v1/hood/push-tasks';
const options = {
  method: 'POST',
  headers: {
    Authorization: "Bearer {TOKEN}",
    'Content-Type': "application/json"
  },
  body: JSON.stringify(
    {
      "name": "Demo",
      "status": 1,
      "start_time": "immediately",
      "targeting": {
        "users": {
          "items": [
            "16601317995517219702"
          ],
          "op": "include"
        }
      },
      "adex": {
        "account_id": 123456,
        "campaign_id": [
          "1011086"
        ],
        "default_campaign_id": 1011086,
        "group_id": [
          "1723"
        ],
        "number_of_messages": 1,
        "repeat_on_click": 0,
        "zone_id": 3002371,
        "fallback_message": {
          "title": "Important Update Available",
          "body": "Please check your app for the latest updates and features.",
          "image": "https://example.com/images/notification-banner.jpg",
          "icon": "https://example.com/icons/app-icon.png",
          "landing_url": "https://example.com/landing/notification",
          "tag": "urgent-update",
          "require_interaction": "1",
          "renotify": "0",
          "silent": "0",
          "vibration": "100,100",
          "badge": "https://example.com/badges/notification-badge.png",
          "actions": [
            {
              "title": "View Details",
              "icon": "https://example.com/icons/action-icon.png",
              "url": "https://example.com/action/learn-more"
            },
            {
              "title": "Dismiss",
              "icon": null,
              "url": null
            }
          ]
        }
      },
      "ttl": "3600",
      "user_time_zone": "0",
      "total_user": "0",
      "frequency": "86400"
    }
  )
};

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/push-tasks");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {TOKEN}",
  "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
  [
    "name" => "Demo",
    "status" => 1,
    "start_time" => "immediately",
    "targeting" => [
      "users" => [
        "items" => [
          "16601317995517219702"
        ],
        "op" => "include"
      ]
    ],
    "adex" => [
      "account_id" => 123456,
      "campaign_id" => [
        "1011086"
      ],
      "default_campaign_id" => 1011086,
      "group_id" => [
        "1723"
      ],
      "number_of_messages" => 1,
      "repeat_on_click" => 0,
      "zone_id" => 3002371,
      "fallback_message" => [
        "title" => "Important Update Available",
        "body" => "Please check your app for the latest updates and features.",
        "image" => "https://example.com/images/notification-banner.jpg",
        "icon" => "https://example.com/icons/app-icon.png",
        "landing_url" => "https://example.com/landing/notification",
        "tag" => "urgent-update",
        "require_interaction" => "1",
        "renotify" => "0",
        "silent" => "0",
        "vibration" => "100,100",
        "badge" => "https://example.com/badges/notification-badge.png",
        "actions" => [
          [
            "title" => "View Details",
            "icon" => "https://example.com/icons/action-icon.png",
            "url" => "https://example.com/action/learn-more"
          ],
          [
            "title" => "Dismiss",
            "icon" => null,
            "url" => null
          ]
        ]
      ]
    ],
    "ttl" => "3600",
    "user_time_zone" => "0",
    "total_user" => "0",
    "frequency" => "86400"
  ]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

Responses

201 Created

{
  "id": "1057"
}

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

Warning
Push task without start_time can not be active.
Note
Push task start_time can not be in the past.
push task end_time can not be set to date before start_time.
To repeat task on equal time intervals you can use frequency field. In order to have more control over repeating intervals you can use cron field. Check request examples for more info.