FAQ
Developer hub
How to create Actions

How to create Actions


Once authentication is configured, your next step is to create an Action—the task your plugin performs when triggered in a workflow. Actions are responsible for making API calls, sending data, or updating records in the external app.


What is an Action?

An Action defines what your plugin will do in a workflow.

Think of it as:
When this trigger fires → perform this action.

For example:

  • Send a message via an API

  • Create a contact in a CRM

  • Update a record in a database


What You’ll Set Up

Here’s what goes into creating a well-functioning action:

  • Scopes – (Optional) Define what level of access this action requires

  • Input Fields – Let users customize inputs like email, name, message, etc.

  • Action JSON – A structured config for the request: method, headers, body

  • Perform API – The actual API endpoint that carries out the action

  • Output Sample – For mapping results to the next step


Example Scenario

Let’s say you’re building a “Send WhatsApp Message” action:

  • Input Fields: recipient number, message text

  • Perform API: POST https://api.twilio.com/messages

  • Action JSON: Includes headers, body template, auth token

  • Output Sample: response with messageId, status, etc.


Best Practices

  • Use context.inputData.fieldKey to dynamically pass user input

  • Include headers, params, and body in JSON as needed

  • Log or return test responses for easier debugging

  • Keep action names and descriptions clear and user-friendly

Create Action Demo
Create Action Demo

Click through a step-by-step, interactive demo walkthrough of Viasocket, powered by Supademo.

https://app.supademo.com/embed/cm66c44pj02ce1xdhl0c5bjyj?embed_v=2

When working with files like audio, images, videos, PDFs, or documents in your workflows, you often need to fetch them from a URL and upload them via an API. Since direct binary data isn’t always supported in APIs, viaSocket uses a standard approach: fetch → convert to base64 → send as JSON.


Why Base64?

APIs commonly accept base64-encoded files instead of raw binaries. This allows files to be:

  • Embedded in JSON payloads

  • Easily transmitted across APIs

  • Supported in actions like transcription, classification, extraction, and more


Supported File Types

This approach works for:

  • 🎧 Audio – MP3, WAV, OGG

  • 🖼️ Images – PNG, JPG, GIF

  • 🎬 Videos – MP4, MOV, AVI

  • 📄 PDFs

  • 📁 Documents – DOCX, XLSX, PPTX

  • 📦 Archives – ZIP, RAR

  • 🧠 Other binaries – firmware, installers


How It Works (in 4 steps)

1. Fetch File from URL

Use Axios to download the file in binary format:

jconst fileResponse = await axios.get(fileUrl, { responseType: 'arraybuffer' }); 

2. Convert File to Base64

Convert the binary data to base64:

const base64File = Buffer.from(fileResponse.data).toString('base64'); 

3. Prepare API Payload

Wrap the base64 in your request payload:

const payload = { data: base64File }; 

4. Send File to API

Send the payload to the API endpoint:

const apiResponse = await axios.post('https://api.example.com/v1/upload', payload, {   headers: {     'Authorization': 'Bearer YOUR_API_KEY',     'Content-Type': 'application/json',   }, }); 

Use Case: Audio Upload for Transcription (ChatGPT)

const audioUrl = context?.inputData?.url; const audioResponse = await axios.get(audioUrl, { responseType: 'arraybuffer' }); const base64str = Buffer.from(audioResponse.data).toString('base64');  const payload = {   model: 'gpt-4o-audio-preview',   modalities: ['text'],   messages: [     {       role: 'user',       content: [         { type: 'text', text: 'Please transcribe this audio recording.' },         { type: 'input_audio', input_audio: { data: base64str, format: 'mp3' } }       ]     }   ],   store: true, };  const apiResponse = await axios.post('https://api.openai.com/v1/chat/completions', payload, {   headers: { 'Content-Type': 'application/json' }, });  return {   Result: apiResponse.data.choices[0].message.content,   ID: apiResponse.data.id,   Created: new Date(apiResponse.data.created * 1000).toLocaleString(),   Model: apiResponse.data.model, }; 


Optional: Filter by Execution Time (for Scheduled Triggers)

To upload only recent files, you can filter data based on when the trigger was executed:

const minutesAgo = new Date(__executionStartTime__ - context?.inputData?.scheduledTime * 60 * 1000); 

This calculates the time X minutes before the trigger ran.

File Upload using URL (for all file types)
Aug 1, 2025