Skip to main content

Workflows: Make API call action

In this guide, we explain how to use API call action using Telegram bot as an example

Updated over a month ago

With the help of an API call, you can integrate NetHunt with virtually any software. To make an API call, you will need to use Automation in NetHunt CRM.

Let's imagine that we need to transfer contact details to a Telegram bot every time we need to notify our team.

To do this:

  • Add a checkbox field or a stage that your client enters to the folder you need, which will be used as a trigger for automation and making an API call:

  • Next, select the “Make API call” action:

  • You will have access to the following list of request types:

We will use POST because we will be transferring values.

Add the API call details, where:

  1. Select the request type - POST

  2. The URL is the webhook taken from the software to which you want to send the information

  3. JSON - data to be sent using the JavaScript Object Notation data format

  4. Macros - the values of the fields you select from NetHunt to share with other software

So, in our case, as soon as a customer reaches the Client lead stage, a trigger is activated and an “API call” sends the information to your personal Telegram account:

Use this guide if you also want to learn how to create a Telegram bot and send messages to your Telegram channel using NetHunt.

Continue the API call step in case of an error

When you make an API call, the service you are contacting provides a response and returns the status of the request. You can use these responses to create a task for yourself or for the person responsible for automation. Check why this problem occurred and fix it quickly.

Check the box in your API call “Continue in case of failed API call”:

Let's review the server response codes:

1xx - Informational (Information about the process)

  • 100 Continue: The initial part of the request has been received, you can continue.

  • 101 Switching Protocols: The server is switching to a different protocol.

2xx - Success (Request successfully processed)

  • 200 OK: The request was successfully completed.

  • 201 Created: The request was completed, a new resource was created.

  • 202 Accepted: Request accepted, but processing not complete.

3xx - Redirection

  • 301 Moved Permanently: The page has moved to a new URL.

  • 302 Found: Temporary redirection.

  • 304 Not Modified: Data has not changed, use cache.

4xx - Client errors

  • 400 Bad Request: Syntax error in the request.

  • 401 Unauthorized: Authorization required.

  • 403 Forbidden: Access to the resource is prohibited.

  • 404 Not Found: Page not found.

  • 405 Method Not Allowed: Method not allowed for the request.

  • 429 Too Many Requests: Request limit exceeded.

5xx - Server errors

  • 500 Internal Server Error: General server error.

  • 502 Bad Gateway: The server received an invalid response from another server.

  • 503 Service Unavailable: The server is overloaded or undergoing maintenance.

  • 504 Gateway Timeout: The server did not receive a response.

This allows you to add a “Filter” step after the “Create” API call step and run different scenarios based on the response code. For example, you can create a filter that checks if the response code is 200. If the execution passes the filter, the workflow continues as usual. If the response code is different, you can initiate an exception branch — for example, create a task for the workflow manager and notify them of a violation in the workflow execution.

Let's add a filter after the API call and specify the error codes that are most likely to occur. For now, we will use the error code 400 Bad Request as an example: a syntax error in the request, possibly the macro has an incorrect format and needs to be checked in the record, or perhaps the manager specified Telegram in the phone field.

Add it to the “Yes” branch, update the field, or create a task for the person responsible. In this case, the response code will be available further in the workflow and can be used as a macro.

This is an additional tool for monitoring API calls to another service so that you don't miss anything important and can check it in a timely manner.


Haven’t found the answers you’re looking for? Ask our Users Community.

Did this answer your question?