Trigger Run via Webhook

Before you can use webhooks, you need to log in to your agent, as described here: Log in to the Agent.

Overview

You would need to make two api calls - the first call to acquire the token and the second call to trigger the webhook.

First, request a login endpoint by sending your username and password.

That will give you a response that looks like this:

{
    "access_token": "AN_ACCESS_TOKEN",
    "refresh_token": "A_REFRESH_TOKEN",
    "user": {
        ...
    }
}

Now take the access and refresh token values and replace them on the webhook endpoint like shown below. This is your second call:

{
  "connector_id": 1,
  "refresh_token": "A_REFRESH_TOKEN",
  "access_token": "AN_ACCESS_TOKEN",
}

Note that you also have to add a bearer auth header like this:

--header 'Authorization: Bearer AN_ACCESS_TOKEN' \

Where to Get connector_id

Open your TaskBot dashboard where you see the list of all your TaskBots. Then, open the TaskBot that you want to trigger. The TaskBot url looks like this: https://creator.zerowork.io/#/workflow/2217. The number that is shown at the end of the url is the connector_id. In this example, it's 2217.

Trigger a TaskBot that You Are Subscribed to on the Marketplace

You will need to use subscription instead of the connector_id like shown here:

{
  "subscription_id": 1,
  "refresh_token": "A_REFRESH_TOKEN",
  "access_token": "AN_ACCESS_TOKEN"
}

Where to Get subscription_id

You can get your subscription_id by opening My TaskBot Subscriptions and then opening the url of the TaskBot you want to automatically trigger. For example, if this url is https://zerowork.io/manage-taskbot/58, then the subscription_id is 58.

OpenApiSpec Documentation

Copy the json from here:

openapi: 3.0.0
info:
  title: Webhook
  version: 1.0.0
servers:
  - url: https://taskbot-server.zerowork.io/
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
paths:
  /auth/login/:
    post:
      tags:
        - General
      summary: Login
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                password:
                  type: string
              example:
                username: 'your_username'
                password: 'your_password'
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /webhook/trigger_run/:
    post:
      tags:
        - General
      summary: Trigger bot run
      security:
        - BearerAuth: [admin]
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                connector_id:
                  type: integer
                access_token:
                  type: string
                refresh_token:
                  type: string
              example:
                connector_id: 1
                refresh_token: ''
                access_token: ''
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}

Video Tutorial: ZeroWork Webhook Triggered from Make (former Integromat) or Zapier

Matt from https://www.fivexfive.co/ explains how to use ZeroWork webhook on Make (former Integromat) or Zapier to trigger your TaskBots automatically.

Last updated