Bit Social logo white version
Bit Social Early Bird LTD: is Live Now
Advanced Social Media Schedule & Auto Poster solution
This offer won't come again, we promise.
Bit Social logo white version
00

days day

00

hours hour

00

minutes minute

00

seconds second

This offer won't come again, we promise.
Bit Integrtaions new logo
Fluent Forms alternatives
Estimated reading: 3 minutes 96 views

Custom Action Integration with Bit Integrations

Custom Action Integration: This feature helps WordPress developers, who want to run a custom PHP function. Developers can easily run their own php function. Follow the steps using the custom action.

To integrate with Custom Action follow, the below steps.

  1. Search & Select Custom Action from the actions pages
Custom Action Integration - search-select
  1. write an initial PHP procedure that is not static and has no access modifier.
Custom Action Integration - write-function
  1. You can access form field values by using the syntax $trigger[], which will then display a drop-down menu with the list of form fields that can be selected.
  2. After writing the function, you must invoke the function.
  3. Then click the Validate button to validate the function. This validation process will check only syntax errorsnot logical errors.
Custom Action Integration - validate-function
  1. After the validation is complete of function, Click on Next to set up the other integration settings ahead.
Custom Action Integration - validate-and-next
  1. Now save the integration by clicking the Finish & Save Button
Custom Action Integration - finish-and-save
  1. At Bit Integrations, the Timeline of each integration contains a feature allowing you to quickly view the status of your integration, whether it has been successful or encountered an error.
Custom Action Integration - timeline-log
  1. You can also easily editClone, or delete the integration.
Custom Action Integration - integration-option

Congratulations, your integration process has been completed successfully. Once the trigger is executed, the function will run successfully.

Custom Action examples

Custom Action has multiple use cases. Here are two examples showing how to work “Custom Action” Does.

Data Field Mapping

Custom Action Integration - Data Field Mapping
  1. Mapped data according to field keywords
  2. Keywords came from the trigger that you received at the top

Nested Data Field Mapping

  1. Defined an empty array
  2. Fill the array with your data fields
Custom Action Integration - Nested Data Field Mapping

Find the keywords

If you don’t know what kind of data you received from the trigger & and don’t know the keywords then you send your whole trigger into API or HOOK and find the keywords from the output result.

HOOK

Custom Action Integration - Custom Action HOOK

API

Custom Action Integration - Custom action API

Use Cases Example

  1. Data sent into the hook
  2. Data sent into API

Use Cases #1: Data sent into the hook

  1. Map data
  2. Define the hook
  3. Put mapped data into the hook
Custom Action Integration - Use Cases 1 Data sent into the hook

Use Cases #2: Data sent into the API

  1. Define API URL/Endpoint
  2. Initialize cURL session including URL
  3. Set cURL options according to your requirements
  4. Attach mapped data in the cURL options
  5. Execute cURL & and close it
Custom Action Integration - Use Cases 2 Data sent into the API
Custom Action Integration - Use Cases 2 Data sent into the API 1

Demo Code

<?php if (!defined('ABSPATH')) {
    exit;
}

function yourFunctionName($trigger)
{
    // defiend an empty array
    $data = [];

    // map Data
    $data['your-key'] = $trigger['your-key'];

    // API URL
    $url = "Your API URL"; // add your API URL

    // Initialize cURL session
    $ch = curl_init($url); 

    // Set CURL options
    curl_setopt($ch, CURLOPT_POST, true); // initial method is POST, you should replace as your requirement
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); // Attach encoded data
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the output as a string
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json', // Set content type to JSON
        // Add other headers if required
    ));

    // response stored in a variable
    $response = curl_exec($ch);
    curl_close($ch);
}

yourFunctionName($trigger);
Share this Doc

Custom Action Integrations

Or copy link

CONTENTS
Subscribe for New Integrations Alert!
bit-integrations-new-logo
© 2024 ABC. All rights reserved by Bit Apps.
Follow us
© 2024 ABC. All rights reserved by Bit Apps.