Connecteur JSON API

json api jungtis pokalbiu marketinge

The StartMsg JSON API connector makes it easy to pass important data to any external URL you specify. For example, when a chosen trigger event occurs, the system automatically sends data in JSON format to your specified webhook URL. It waits up to 10 seconds for a response; if none arrives, it sends the request again. This is an excellent way to integrate StartMsg with other third-party platforms such as Zapier, or to build fully custom solutions. The JSON API connector features are easy to find in the “Messenger Bot” menu section.

Full connection management

Using the JSON API connector panel, you can not only create new connections, but also monitor activity, edit existing ones or remove those you no longer need. This makes it easy to manage the entire process of communicating with external systems, react quickly to changes and adjust the configuration to your needs.

Creating a new connection is simple

To create a new connection, just click the “New connection” button and complete a few simple steps:

  • Connection name: Name the connection so it is easy to identify among the others.
  • Webhook URL: Enter the URL the data will be sent to. You can get this URL from other apps such as Zapier, or point it to your own application URL. The JSON data is sent to this URL, and the system waits up to 10 seconds for a response.
  • Choose a page: In this field you can select a page connected to the Messenger bot that you want to collect data from.
  • Which field triggers the webhook: Choose the field that should trigger the webhook. The options include email, phone number, location, postback, date of birth or webview forms. For example, if you select email, the webhook fires when a new address is collected by the Messenger bot. If needed, you can select more than one field.
  • Which data you want to send: Choose the information that will be sent when the webhook is triggered. Here is an example of what the data might look like:

{
“psid”:”12765756″,
“first_name”:”Test”,
“last_name”:”User”,
“subscribed_at”:”2024-01-15 12:19:04″,
“email”:”testuser@gmail.com”,
“labels”:”Demo,Demo Label 1,new-label-test”,
“page_id”:”37674343246″,
“page_name”:”Test Page”,
“phone_number”:”+370628282846″,
“user_location”:””,
“postbackid”:””,
“subscriber_id”:”2251324188330310″,
“webview_form_id”:”83c567cd88″,
“product-type”:”Shoes”,
“Size”:”Medium”,
“Phone-Number”:”88823″,
“Delivery-Date”:”2024-01-15″
}


Clear connection reports

You can monitor every connection you create through the dashboard. The activity report lets you see the last 10 actions and the main settings. If a connection triggers successfully, the HTTP code will show “200”. The reports section also lets you see what data was sent during the most recent triggers.

Adding a PHP script as the webhook URL

If you want to use your own script to receive JSON data, you can do so by adding your URL as the webhook. For example, if your domain is “https://example.com” and the script is called “test.php”, the webhook URL will be “https://example.com/test.php“. When the chosen trigger event occurs, the system sends data to this URL. To receive JSON data, add this code to your “test.php” file:

$webhook_data = file_get_contents(“php://input”);
$webhook_data_array = json_decode($webhook_data, true);

By using the StartMsg JSON API connector, you can not only automate important business operations, but also adapt the platform so it works together with the other apps you use.



  • Vue d'ensemble