Custom block - api configuration

Hi, I’ve been trying to get custom actions and triggers working but don’t understand how to set up the API. I’ve set up the base URL using ngrok and the built-in apps work. However, the following block for both trigger and action when set up with the paths specific return the following error:



return the following error:
image
I’ve referred to the following article but am not clear what to do where to resolve: Custom Triggers

Hello there @jason_dialog and welcome to the community!

I hope you like it here :muscle:
Which subscribe and and unsubscribe URLs are you using in the custom trigger?

Do you have those endpoints running in a project in the same port as ngrok?

Looking forward to hearing from you :slightly_smiling_face:

Cheers,
Matias

Hi Matais, thanks for responding to my call for help. I set the URLs to the example suggested
/monday/subscribe and monday/unsubscribe so it would point to my ngrok address.

I don’t have the endpoints running in the project, in the same port. Maybe if you can point me to what file or code I have to insert where to set that up.

Hello there @jason_dialog!

If you are using ngrok, you have probably started ngrok and got a forwarding URL such as https://111-22-333-44-555.ngrok.io

You have to add that URL in your app, in your integration feature, in the “Feature details” tab, in the “Base URL” field.

Your ngrok is working on a specific port. You will see in your terminal when you start ngrok that it says something like https://111-22-333-44-555.ngrok.iohttp://localhost:3000. In this case, 3000 would be that port. Then you have to run the file/project in which you have those endpoints (/monday/subscribe and /monday/unsubscribe) in the same port.

For example, in my example code, those endpoints look like this:

  app.post("/monday/subscribe", function (req, res) {
	console.log(req.body)
	res.send(res.body);
  });

And to run my project y open the terminal in Visual Studio Code, go to the folder which contains my file (the file that contains these endpoints) and in the terminal I run node filename.js

It is important to note that I have these lines of code in my file:

import express from "express";
import http from "http";
import bodyParser from "body-parser";
const app = express();
app.use(bodyParser.json());
const server = http.createServer(app);
server.listen(process.env.PORT || 3000, function() {
console.log('Express server listening on port 3000.');
})

Hope the examples help!

Cheers,
Matias

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.