How to create Actions


After completing the authentication process, the next step is to create the desired action for the plugin in viaSocket. This guide will walk you through the process of creating an action, defining necessary scopes, constructing the action JSON, and adding the final perform API.

What are Actions?


Actions are specific tasks or operations executed as part of an automated process. These tasks are triggered by certain events or conditions and can range from simple data manipulations to complex API interactions. Actions are fundamental to automating workflows, allowing seamless integration and interaction between different applications.

📌For example, an action could be "Send an Email in Gmail." This action occurs after a trigger event, such as receiving a new form submission in a web app.


Add additionally required scopes

To perform the particular action if any other scopes is required enter it in the action scopes.




Now we have to write Action JSON:

The concept of "action JSON" in a viaSocket plugin refers to the structured JSON format used to define the fields of an action that are selected by the user when he/she uses that plugin. This JSON structure typically includes text fields,dropdowns, input groups etc .

Here is a simplified version of what an action JSON might look like : 

[
  {
    
"key": "username",
    
"label": "username",
    
"type": "string",
    
"required": true,
    
"list": false,
    
"altersDynamicFields": false
  },
  {
    
"key": "email",
    
"label": "email",
    
"type": "string",
    
"required": true,
    
"list": false,
    
"altersDynamicFields": false
  },
  {
    
"key": "contact",
    
"label": "contact",
    
"type": "dropdown",
    
"required": true,
    
"list": false,
    
"altersDynamicFields": false
  }
]


🔴To Get value of the field use `${context.inputData.field_key}`

🔴To know more about the JSON and its fields types refer the doc https://viasocket.com/faq/create-plugin

🔴For escape json use https://www.freeformatter.com/json-escape.html#before-output


Perform API:

The last step to complete the action is to add a final perform API. This API is responsible for performing the action. For detailed explanation Click here. 

Example : 



Support

For further assistance, visit the viaSocket support page or contact our support team at support@viasocket.com.