Skip to main content

Hello So I created a button that when clicked it runs a script and the script connects to a webhook and sends some fields to the webhook.

But I added an input field at the beginning. First it asks your to input some text, and then send all the information to a webhook but have no idea how to send the input text. I appreciate your help.


This is the code:


let name = await input.textAsync(‘Escribe aqui la tarea’);

output.text(Your name is ${name}.);


// Webhook URL

let webhook = ‘httpsWebhookURL’


// Airtable Script Button Text

let actionDescription = ‘Creando una tarea de esta integracion’


// Table to send data from

let tableName = ‘Interacciones’


// Fields to bind and send

let fieldsToSend = ‘Descripcion’, ‘Compañia’]


// !--------------------! //


let table = base.getTable(tableName);

let record = await input.recordAsync(actionDescription, table);

let queryParams = /?id=${record.id}

if(fieldsToSend.length > 0){

function buildParams(fieldName) {

let fieldValue = record.getCellValueAsString(fieldName)

queryParams += &${encodeURIComponent(fieldName)}=${encodeURIComponent(fieldValue)}

}

fieldsToSend.forEach(buildParams);

}

const returnedPayload = await fetch(${webhook}${queryParams});

var payloadResponse = await returnedPayload.json()

let results = payloadResponse.result;

output.text(results)

Any help please? Thats the only thing that im missing to conclude a project. All help is appreciated.


What does the documentation for the service receiving the webhook say? Different webhooks need information packaged in different formats. Also, not all webhooks return data.


Have you tried outputting ${webhook}${queryParams} to make sure that it has the expected value?


It looks like you are using url query parameters to pass the data. However, not all webhooks accept data that way.


What does the documentation for the service receiving the webhook say? Different webhooks need information packaged in different formats. Also, not all webhooks return data.


Have you tried outputting ${webhook}${queryParams} to make sure that it has the expected value?


It looks like you are using url query parameters to pass the data. However, not all webhooks accept data that way.


Hello, yes it does have:



But I need to add the input text to the webhook. Yeah, the webhook does accept data.


Reply