API for Email marketing services
This API was developed to integrate with external email services. It allows you to manage mailing lists and contacts via a single endpoint (e.g., https://yourserver.com/planfix_integration.php) and accepts requests in JSON format.
Once you have implemented the integration, you can contact our Support Service to add your service to the list of integrations available to users in the Planfix interface.
Connecting to Planfix
- Go to the Account management — Integrations — Email marketing section to connect and configure the integration.
- In the opened section, select Planfix API at the end of the list.
- A window for the integration settings will open.
- You must specify the address where Planfix should send the requests and the API Key for authorization.
Request format
The request is sent via POST method in JSON format to the address specified in the integration settings.
Request Example:
{ "action": "action", "authToken": "your_authorization_token", "data": { // Data depending on the action } }
Request Parameters:
Name | Description | Type/Data Format | Note |
---|---|---|---|
action | The action to be performed | string | |
authToken | Authorization token for API access | string | |
data | Data depending on the action | object |
Supported actions
- createList — create a mailing list
- deleteList — delete a mailing list
- importContacts — import contacts into a list
- updateContact — update contact
createList — Create a mailing list
Description: Creates a new mailing list with the specified name.
Request:
{ "action": "createList", "authToken": "your_authorization_token", "data": { "listName": "List name" } }
'Response (success):
{ "success": true, "listId": "unique_list_identifier"" }
Response (error):
{ "error": "Error description" }
deleteList — Delete a mailing list
Description: Deletes a mailing list by its identifier.
Request:
{ "action": "deleteList", "authToken": "your_authorization_token", "data": { "listId": "list_identifier" } }
Response (success):
{ "success": true }
Response (error):
{ "error": "Error description" }
importContacts — Import contacts into a List
Description: Imports contacts into the specified mailing list.
Request:
{ "action": "importContacts", "authToken": "your_authorization_token", "data": { "listId": "list_identifier", "contacts": [ { "id": 123, "email": "email@example.com", "firstName": "Name", "lastName": "Last name" } ] } }
Response (success):
{ "success": true }
Response (error):
{ "error": "Error description" }
updateContact — Update сontact
Description: Updates a contact in the mailing list. Supports actions: add, update, delete.
Request:
{ "action": "updateContact", "authToken": "your_authorization_token", "data": { "listId": "list_identifier", "action": "add|update|delete", "contact": { "id": 123, "email": "email@example.com", "firstName": "First name", "lastName": "Last name" }, "oldEmail": "old_email@example.com" // only for action=update } }
Response (success):
{ "success": true }
Response (error):
{ "error": "Error description" }
Important
- All requests must return a response in JSON format.
- In the event of an error, the "error" field with a description of the error must always be present.
- In the event of a success, the "success": true field must always be present.
- Authorization is done through the "authToken" field in each request.
- All text fields must be encoded in UTF-8.