Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This import statement gives you access to all parts of the Coda Packs SDK.
- import * as coda from "@codahq/packs-sdk";
- // This line creates your new Pack.
- export const pack = coda.newPack();
- // Here, we add a new formula to this Pack.
- pack.addFormula({
- // This is the name that will be called in the formula builder.
- // Remember, your formula name cannot have spaces in it.
- name: "Integromat_Webhook",
- description: "A button Action to trigger an Integromat webhook without opening a new window.",
- isAction: true,
- // If your formula requires one or more inputs, you’ll define them here.
- // Here, we're creating a string input called “name”.
- parameters: [
- coda.makeParameter({
- type: coda.ParameterType.String,
- name: "webhook",
- description: "The full url of the webhook you want to trigger.",
- }),
- ],
- // The resultType defines what will be returned in your Coda doc. Here, we're
- // returning a simple text string.
- resultType: coda.ValueType.String,
- // Everything inside this execute statement will happen anytime your Coda
- // formula is called in a doc. An array of all user inputs is always the 1st
- // parameter.
- execute: async function ([webhook], context) {
- let response = await context.fetcher.fetch({ method: "POST", url: webhook });
- // Return values are optional but recommended. Returning a URL or other
- // unique identifier is recommended when creating a new entity.
- return response.body;
- },
- });
- pack.addNetworkDomain('integromat.com');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement