Allowed language: JavaScript
Maximum code execution time: 60 seconds
Same as the Code Node by default.
Only the
chromiumobject from the Playwright library can be used.
All code must be written inside the function above.
memoryandcontext: refer to the Code Node documentation for details.
Move to directory you want to make code
Install Node.js through https://nodejs.org/en/download
Install Playwright version 1.55.0:
npm install playwright@1.55.0Install the Playwright Chromium browser:
npx playwright install chromiumStart code generation:
npx playwright codegen URL-of-the-site-to-visit --target=javascript --output=script.jsRunning the above command will open a browser.
Perform the required actions in the browser as shown in the video, and you can obtain the JavaScript code.
Copy the code generated between newContext() and context.close() into your Browser Automation Node code template:
Paste the code you copied from the video into the Browser Automation Node.
You can verify it works using the Test feature.
The output of your browser automation code can be downloaded as a video.
Click
Test→Run→Logs→Output filein order to download the video.
We’ll walk through the integration process using Channel Talk Admin.Let’s say a message has been received from a channel with ID 7284. When certain conditions are met, we want to credit a customer’s deposit balance.We’ll use a Browser Automation Node to automate the browser activity required for crediting the deposit.
First, refer to Section 2: Writing Code to obtain the browser launch script.From the code in script.js, copy only the required parts (as described in “Writing Code”) and paste them into the Browser Automation Node.
If it fails, ensure that the target service allows requests from the public IP of the Browser Automation Node.
Now, suppose we want to credit deposits to different channels depending on the customer’s data.In this case, we can use customer, chat, or memory information.For example, let’s use the channelId from the chat information.
You can retrieve this value using:
By using memory or context, you can connect customer information with your Browser Automation Node.
Services like admin panels often restrict access to specific IP ranges.Ask your development team to allow the public IP of the Browser Automation Node.You can obtain the IP information by contacting Channel Talk support.
The Browser Automation Node executes specific actions and may stop immediately after finishing them.It doesn’t automatically wait for a request to complete.If you want it to wait—for example, after clicking a button—add an extra step that clicks the “Completed” popup (or any element that appears after the process finishes).This ensures that the node waits for the action to fully complete before exiting.