Optimization Applied

This webhook is triggered when Bringg completes a round of route optimization. It includes the details of the routes and any orders Bringg was not able to assign to a route.

Webhook

{
   "unassigned_tasks": [
      {
         "id": 12345678,
         "status": 0,
         "title": "Order for testing",
         "external_id": 101,
         "way_points": [
            {
               "id": 545123,
               "position": 2,
               "scheduled_at": null,
               "eta": null,
               "address": "456 Elm Street, Sometown"
            }
         ],
         "reason": "cannot be visited within time window",
         "reason_code": 5
      }
   ],
   "actual_breaks": [
      {
         "user_id": null,
         "id": null
      }
   ],
   "runs": [
      {
         "id": 6751234,
         "user_id": 17537,
         "estimated_distance_traveled": null,
         "team_id": 1168,
         "scheduled_end_time": "2023-02-20T11:36:00.000Z",
         "external_id": "ext_6751234",
         "tasks": [
            {
               "id": 40940001,
               "status": 1,
               "title": "Task_A",
               "external_id": "ext_task_A_20230220",
               "way_points": [
                  {
                     "id": 53922001,
                     "position": 2,
                     "scheduled_at": "2023-02-20T09:45:00.000Z",
                     "eta": "2023-02-20T09:45:00.000Z",
                     "address": "100 Example Street"
                  }
               ]
            },
            {
               "id": 40940002,
               "status": 1,
               "title": "Task_B",
               "external_id": "ext_task_B_20230220",
               "way_points": [
                  {
                     "id": 53922002,
                     "position": 2,
                     "scheduled_at": "2023-02-20T08:27:00.000Z",
                     "eta": "2023-02-20T08:27:00.000Z",
                     "address": "200 Sample Avenue"
                  }
               ]
            },
            {
               "id": 40940003,
               "status": 6,
               "title": "Task_C",
               "external_id": "ext_task_C_20230220",
               "way_points": [
                  {
                     "id": 53922003,
                     "position": 2,
                     "scheduled_at": "2023-02-20T11:00:00.000Z",
                     "eta": "2023-02-20T11:00:00.000Z",
                     "address": "300 Placeholder Blvd"
                  }
               ]
            },
            {
               "id": 40940004,
               "status": 1,
               "title": "Task_D",
               "external_id": "ext_task_D_20230220",
               "way_points": [
                  {
                     "id": 53922004,
                     "position": 2,
                     "scheduled_at": "2023-02-20T08:01:00.000Z",
                     "eta": "2023-02-20T08:01:00.000Z",
                     "address": "400 Fake Road"
                  }
               ]
            },
            {
               "id": 40940005,
               "status": 1,
               "title": "Task_E",
               "external_id": "ext_task_E_20230220",
               "way_points": [
                  {
                     "id": 53922005,
                     "position": 2,
                     "scheduled_at": "2023-02-20T09:18:00.000Z",
                     "eta": "2023-02-20T09:18:00.000Z",
                     "address": "500 Fictional St"
                  }
               ]
            },
            {
               "id": 40940006,
               "status": 1,
               "title": "Task_F",
               "external_id": "ext_task_F_20230220",
               "way_points": [
                  {
                     "id": 53922006,
                     "position": 2,
                     "scheduled_at": "2023-02-20T08:57:00.000Z",
                     "eta": "2023-02-20T08:57:00.000Z",
                     "address": "600 Imaginary Ln"
                  }
               ]
            },
            {
               "id": 40940007,
               "status": 1,
               "title": "Task_G",
               "external_id": "ext_task_G_20230220",
               "way_points": [
                  {
                     "id": 53922007,
                     "position": 2,
                     "scheduled_at": "2023-02-20T07:34:00.000Z",
                     "eta": "2023-02-20T07:34:00.000Z",
                     "address": "700 Pretend Ave"
                  }
               ]
            },
            {
               "id": 40940008,
               "status": 1,
               "title": "Task_H",
               "external_id": "ext_task_H_20230220",
               "way_points": [
                  {
                     "id": 53922008,
                     "position": 2,
                     "scheduled_at": "2023-02-20T10:07:00.000Z",
                     "eta": "2023-02-20T10:07:00.000Z",
                     "address": "800 Example Circle"
                  }
               ]
            },
            {
               "id": 40940009,
               "status": 1,
               "title": "Task_I",
               "external_id": "ext_task_I_20230220",
               "way_points": [
                  {
                     "id": 53922009,
                     "position": 2,
                     "scheduled_at": "2023-02-20T06:46:00.000Z",
                     "eta": "2023-02-20T06:46:00.000Z",
                     "address": "900 Test Way"
                  }
               ]
            }
         ],
         "user": {
            "id": 17537,
            "name": "Test User",
            "status": "offline",
            "sub": "Assigned",
            "phone": "",
            "external_id": "user_602"
         }
      }
   ],
   "origin": "scheduled_route_optimization",
   "team_id": 1168,
   "webhook_type": "optimization_applied",
   "merchant_id": 101
}
{
  "unassigned_tasks": [
    {
      "id": 1234,
      "status": 0,
      "title": "Delivery Task",
      "external_id": "108-Ab4",
      "way_points": [
        {
          "id": 9876,
          "position": 1,
          "scheduled_at": null,
          "eta": null,
          "address": "123 Main St. New York, NY 10001",
        },
        {
          "id": 9877,
          "position": 2,
          "scheduled_at": "2023-01-01T12:47:00.000Z",
          "eta": "2023-01-01T12:47:00.000Z",
          "address": "123 1st Ave. New York, NY 10002"
        }
      ]
    }
  ],
  "runs": [
    {
      "id": 4567,
      "team_id": null,
			"scheduled_start_time": "2023-01-01T12:25:00.000Z",
      "scheduled_end_time": "2023-01-01T15:47:00.000Z",
      "external_id": "4567",
      "tasks": [
        {
          "id": 1236,
          "status": 6,
          "title": "Delivery Task",
          "external_id": "h9371",
          "way_points": [
            {
              "id": 9878,
         			"position": 1,
              "scheduled_at": null,
              "eta": null,
              "address": "123 Main St. New York, NY 10001",
            },
            {
              "id": 9879,
              "position": 2,
              "scheduled_at": "2023-01-01T12:47:00.000Z",
              "eta": "2023-01-01T12:47:00.000Z",
              "address": "123 1st Ave. New York, NY 10002"
            }
          ]
        }
      ],
      "user": {
        "id": 5740,
        "name": "Debbie Driver",
        "phone": "+15555555555,
        "external_id": "DBD-1937"
      }
    }
  ],
  "actual_breaks": [
    {
      "id": 1234,
      "user_id": 5740
    }
  ],
  "webhook_type": "optimization_applied",
  "merchant_id": 12362,
}

Default Output Params

The following fields are included in the Optimization Applied webhook.

Field

Description

  • *actual_breaks**
    array

Details of the driver's breaks.

  • *runs**
    array

Array of JSON objects detailing each order on the route.

  • *unassigned_tasks**
    array

Array of JSON objects detailing any orders that Bringg could not add to a route.

Recommended Flexible Params

The following parameters can be included as part of a flexible webhook.

Field

Description

  • *origin**
    string

The system or event that initiated route optimization.

  • *reason**
    string

If an order could not be assigned by route optimization, the reason it could not be assigned is included.

  • *reason_code**
    integer

Bringg's error code for an unassigned order.