My First Call to the Web Services

Modified on Tue, 9 Sep at 4:50 PM

To familiarize yourself with Dialog Insight's web services, there's no better way than to dive into the code right away. Let's make a first call together in your test project. For this example, we'll use the Contacts.Merge method, which is ideal for beginners. This method allows you to create a contact or update its information if it already exists in a single call.


Recommended Reading

If you start from zero with Dialog Insight, we recommend that you read the following articles to learn on the possibilities of Dialog Insight's platform and the web services:


Step 1: Create a Test Project

When starting out with call testing with Dialog Insight, the best precaution is to start by creating a dedicated test project. This isolated environment acts as a sandbox: you can experiment, validate API calls, simulate campaigns, or manipulate data without risking the data actually used in production. A test project provides a secure workspace where you can test without fear of accidentally sending a message to a customer, corrupting data, or falsifying statistics. Unlike a real project, its purpose is not to support daily operations, but rather to allow developers to work freely, verify their scripts, and learn how to use the platform.


It may be tempting to use a project already in production, but the risks are high. A misconfigured API request or automation could trigger emails or SMS messages to real recipients. Import or update errors could modify or even delete critical information. Even simple test recordings can pollute your reports and performance indicators. Added to this is the legal issue: using real personal data in technical tests can pose a compliance problem with laws, particularly the GDPR or Law 25.

Option 1: Create a project from scratch

Go in your account and create a new project:

For more details on the steps to create a project, read Creating a Project.


Option 2: Duplicate an existing project

Go to the list of projects and click Duplicate at the end of the line of the project you want to duplicate: 


Wether you chose option 1 or 2, give a name and description to your project that will indicate explicitly it is a test project (e.g.,  "Project – TEST" or "Sandbox API "):


Good Practices for Test Projects
  • When importing data into this project, use only dummy data, such as generic addresses or test-only domains. Use generic or formatted email addresses for your tests (test1@example.com, api.demo@domain.test).
  • When importing data into this project, use only dummy data, such as generic addresses or test-only domains. Use generic or formatted email addresses for your tests (test1@example.com, api.demo@domain.test).
  • If possible, set up a test-only sending domain for the entire account.
  • Also, consider limiting or redirecting submissions so your essays never leave the intended scope.
  • Document the structure and uses of the test project so that the entire team knows how to use it correctly. Regular data cleanup will also help keep the environment clean and easy to use.

Step 2: Create a Web Services Key

Web services keys allow your application or scripts to interact with the platform via the API. Specifically, keys are used to authenticate and authorize your calls, whether in a test project or a project used to manage your contact data. Each key provides different access points: projects, tables, services (endpoints). Before creating your key, it's important to understand its role, its security implications, and best practices for managing it.


To get started, reate one for your test project. This will help you familiarize yourself with how it works. Limit permissions for this key to the test project to prevent unwanted actions in other projects in your company account. You can create separate keys for each environment (development, test, production).


→ Read the procedure to create a key


Good Practices for Web Services Keys

  • Limit permissions to what is strictly necessary.
  • Clearly label keys to quickly identify their use.
  • Store keys securely in environment variables or a secrets manager, never in clear text in code.
  • Document in your repository or internal wiki which keys are used by which services.
  • Change your keys periodically to limit risks.
  • Immediately delete a key if it is compromised.
  • Generate test environment-specific API keys to avoid configuration errors.

Step 3: Consult the endpoint and method

First, go to the documentation that corresponds to the environment used in your account.


Links to the documentation
Canada: https://app.dialoginsight.com/fe/webservices/about
France: https://app.mydialoginsight.com/fe/webservices/about


On the left, in the web services list, find the Contacts endpoint and click the Merge method:In the documentation of each method, you will find a full description of the method and examples of request and responses in JSON.  


Step 4: Generate an Example

In the Contacts.Merge page, find the Try it button (it is a little subtle):



In the request editor, use the advanced mode and click Generate a sample: 

Step 5: Adapt the Example

The generated example serves as a useful basis for creating your call. All you have to do is add the information that's appropriate for your situation.

Authkey

When you have created your web services key, the key generated has the idkey and key parameters, which you have to add the values here. 


idProject    

To learn how to find your idProject, read this article.


Records

Add the contact data to be imported according to the structure set up in your project.


The example shows a common case with a project key with email (key_f_email) in which you specify the contact to add or update with their email address. The key may be different in your project. Sometimes the key is a customer number.

→ Learn more about primary keys and duplicate management


In Data, fields are written with "f_" followed by the field code (the destination for the data in the project). You can find the code of a field in the project's list, which can be accessed through Project → Data Management → Project Fields. In this way, "FirstName" becomes "f_FirstName".


Step 6: Send the Request

You don't need to use a URL in the test interface. It's added behind the scenes. Although the interface is named test, calls are actually sent to the project specified in the idProject. So be careful with the requests sent here.


When you are ready, click Submit request:

 

Results

If the answer is positive and there are no runtime errors, you will be able to see the contacts added to the list in your project. To consult the list, go to dans Audience → Contacts.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article