viaSocket Embed
Learn how to integrate viaSocket's functionalities directly into your applications. This section offers guidance on embedding viaSocket Flow, enabling seamless interaction within your platform.

This document will help you to understand how to create the JWT token for integrating the viasocket.
Creating JWT token
To create JWT token you need to get org_id, user_id, project_id and access key.
We will be using the HS256 to encrypt the JWT token.
While setting up the SDK from viasocket, we will provide you the project_id, org_id and access key.

create an json using the required details as shown below.
{
"org_id": "Tix4zpLRv9vq",
"project_id": "projQRZP6Nzm",
"user_id": "[email protected]"
}
and create the JWT token using the json and provided access key.
After generating the JWT token, include it as a parameter within the script tag with the ID 'viasocket-embed-main-script', specifically in the embedToken parameter. This will facilitate seamless integration.
Note: Flows of a embed project will be different for all the users, so make sure you pass unique user_id to make sure every users have their own flows.
create JWT token
Nov 8, 2024Go to Integrations, you will find it in Developer Hub options.
Create an IntegrationChoose your service and its actions or triggers it allows for other apps to integrate, if you are choosing a webhook as trigger you can also choose the response format.
Adjust Display Configuration
You can configure the Via-socket embed component in the Configuration Tab, where you have the ability to set dimensions, select the default or custom Button, to determine whether it should be styled by us or not. This gives you control over various aspects of the component's appearance and functionality, allowing for a tailored integration that aligns with your preferences and design requirements.
Generate JWT token
To generate a JWT token, please refer to the Configuration Tab for the required data. Additionally, ensure to include the user_id, which serves as a unique identifier for each user instance. Users will only have access to view flows associated with their respective user_id. You can create a token simply with jwt.io.
Copy SDK code
Please integrate the following code snippet into your application's existing codebase. It is essential to maintain consistency with the provided IDs and attributes. You can skip to pass the open button's ID if button is set to custom.
The openViasocket function is versatile and can be utilized to open a specific flow by passing the flow ID as a parameter.
Sharing Data to Parent
Using the window.addEventListener('message'), shown in the above SDK image, you can get the valuable information about a particular flow when any action is performed by the user in the below format.
{ |
- "action" will show the status about a flow.
- "initiated" : This will show if the flow is created for the first time or has not been published yet.
- "published" : This action will tell user that the flow has been published.
- "deleted" : This is for when the flow gets deleted.
- "description" will tell us about what this flow does.
- "id" is a unique flow identifier.
- "webhookurl" is flow invocation URL.
- "payload" : It consist the payload which is used to hit the webhookurl of flow.
Follow More Articles like this:-
Steps to integrate Embed
Nov 8, 2024viaSocket makes it easy for you to display and enable integrations between your platform and the apps your users frequently automate with. By embedding a simple script, you can provide a seamless way for users to discover and connect integrations directly from your platform.
This script can be used on your website, blogs, or even within your product to highlight key use cases.
Integration Script
To implement this functionality, add the following script to your website:
<script
primaryApp ="app_slug_name"
appName1="app_slug_name"
appName2=""app_slug_name"
id ='viasocket_integrations'
crossorigin="anonymous"
src="https://integrations.viasocket.com/integrations.js"></script>
How It Works
primaryApp
– Defines your platform as the main app for which integrations will be displayed.appName1
toappName5
– Specifies the app’s slug name that your users frequently integrate with.How many apps can you integrate?
You can integrate up to 10 apps with the primary app using a script.
How to Find Slug Name of the App?
To find the slug name of the app viaSocket, follow these steps:
Go to the integration page of viaSocket.
Search for the app you are interested in (e.g., GoHighLevel).
In the URL, after "https://viasocket.com/integrations/", you will find the slug name of the app.
For example, if the URL is
https://viasocket.com/integrations/gohighlevel
, the slug name of the app isgohighlevel
.
Simply copy the last part of the URL after "integrations/" to get the correct slug name.
Benefits of Adding This Script
Showcase Relevant Integrations – Display the most commonly used integrations for your platform.
Enhance User Experience – Allow users to discover and set up automation without leaving your platform.
Quick Implementation – Simply copy and paste the script, customize it, and go live.
Flexible Placement – Use it on your website, blogs, or inside your product to illustrate real-world use cases.
Getting Started
Copy the script above and paste it into your website’s HTML.
Replace
your-app
with your actual platform’s name.Update
appName1
toappName5
with the apps your users commonly automate with.Save and deploy the changes to your website, blog, or product interface.
Once implemented, this will provide an interactive way for your users to explore and set up integrations effortlessly.
For any assistance, feel free to reach out.