Skip to main content

ERP Integration

ERP integration enables real-time information exchange between our system and your ERP. With this integration, you can bring data from your ERP and incorporate it into customer service interactions. Additionally, the integration allows you to receive notifications for various types of events generated by the system.

Enabling ERP Integration

To use ERP integration, edit a registered instance and enable its usage by checking the activation box:

Contact Panel

Register a URL in the Contact Panel field to embed features from your system directly into the service window:

Attention

It is recommended that your iframe works at a maximum width of 300px.

Tip

It is highly recommended to use the https protocol.

Once the URL is registered, a POST request will be triggered each time a profile is opened. This request will send all available contact information:

{
"tipo_envio": "common",
"referencia": "api send",
"mensagens": [
{
"numero": "11999999999",
"mensagem": "test message 1"
},
{
"numero": "11999999998",
"mensagem": "test message 2"
}
]
}

Customization

Customize the content of messages sent using customizable templates.

Available text formatting:

_text_ Text in italic
*text* Text in bold
~text~ Text strikethrough

Available variables:

VariableDescriptionExample
$UsuarioNome$Name of the agent who sent the messageMaria
$UsuarioLogin$Login email of the agent who sent the messagemaria@erp.com
$IdUsuario$Unique identifier code of the agent001
$Departamento$Name of the department the agent belongs toSupport
$JidDestiny$JID of the contact being assisted5511987654321@s.whatsapp.net
$TextMessage$Message typed by the agentGood morning!
Attention

All available variables are enclosed between the symbol $, for example: $var_name$

Events

Integration with your ERP allows you to register URLs that will receive various events generated by the system. For each event below, you can register a specific callback URL:

EVENTDescription
OnLoadContactWhen loading a contact. Triggered right after the contact profile is selected and loaded. Can be used to update profile fields before the data is displayed on the screen. Example ↓
OnBeforeSaveContactBefore saving a contact. Mainly used for validating user data and/or applying business rules before the contact is saved.
OnSaveContactAfter saving a contact. Occurs if the OnBeforeSaveContact event returns true.
OnStartConversationAfter starting a conversation. Occurs when the first message is sent to the contact.
OnEndConversationWhen ending a conversation. Occurs when the service is automatically finalized by the system or manually by the operator.
coming soon!
OnGetChatMessageSugestionEvent to be called to return a matrix of response suggestions. Triggered with each new reply from the contact. coming soon!

Register the event URL to be triggered in one of the fields described above, using the following format:

https://my-erp.com.br/api/OnLoadContact.php?jid=`$Jid$`&status=`$Status$`

Available Variables

VariableDescriptionReturns
$InstanceId$Unique identifier code of the instance.integer
$ProfileId$Unique identifier code of the profile.integer
$Jid$Contact JID - provided by WhatsApp.string
Example: 5511987654321@s.whatsapp.net
$name$Contact namestring
Example: Maria
$isGroup$Whether the contact is a group.true or false
$StatusInt$Contact status in numeric format.0 Normal
1 Locked
2 Archived
3 Blocked
$Status$Contact status.string
Example: Locked
$LockedUserId$Unique code of the operator to whom the contact is locked.integer
$LockedUserName$Name of the operator to whom the contact is locked.string
Example: Agent Maria
$LockedUserLogin$Email of the operator to whom the contact is locked.string
Example: maria@company.com
$DepartmentId$Unique code of the department the contact belongs to.integer
$Department$Name of the department to which the contact was transferred or belongs.string
Example: Finance
$SegmentName$Name of the segment selected for the contact, previously registered in
the instance settings, under Classifications.
string
$LastMessageId$Unique code of the last chat message.integer
$MsgRead$Number of messages sent and read by the contact.integer
$MsgUnread$Number of unread messages from the contact.integer
$Email$Email registered for the contact.string
Example: felipe@gmail.com
$Phone$Phone number registered for the contact.
If not registered, returns the phone number according to the contact's JID.
string
Example: (54) 9876-5432
$Document$Document registered for the contact.string
Example: 123.456.789-10
$Note$Note registered in the ... tab in the contact's record,
and shown below the profile photo in the contact list.
string
$CreateDate$Date and time the contact was created.timestamp
Example:20210205 13:47:00
$LastStatusDateTime$Date and time of the last status update for the contact.timestamp
Example: 20210205 13:47:00
$LockedUserDate$Date and time when the contact was locked.timestamp
Example: 20210205 15:55:00
$wid$Instance WIDstring
Example: C61BBC40-D019-427A-A31C-230243E27242

OnLoadContact

You can return a json with the updated contact profile. Example of a profile to be returned:

Use the variables $jid$ and $webid$ in the informed URL, to receive the identifier of the current contact in your API.

{
"Name": "Maria",
"Email": "maria@gmail.com",
"SegmentName": "",
"Telefone": "(11) 98765-4321",
"UrlInfo": "http://my-erp.com.br/panel?jid=5511987654321@s.whatsapp.net", // custom iframe
"UrlPicture": "http://my-erp.com.br/updatedPicture?jid=5511987654321@s.whatsapp.net",
"MemoText": "Call tomorrow",
"Document": "123.456.789-10",
"Priority": 1, // 1, 2 or 3
"Group": "",
"CSS": "",
"InternalID": ""
}
Tip

There is no need to fill in all fields.

Attention

The returned profile will permanently replace the existing profile content.

The URL returned in the UrlInfo field will be used in the contact's iframe:

Variables API

If you need to save variables on our platform, use our variables API.

EndPoint  https://witi.me/api/witime/savevars.aspx?key=API_KEY&WID=INSTANCE_WID&NAME=VARIABLE_NAME
Method     POST
Body       json or text content to be saved
Return    "OK" if saved successfully

Attention

The variable name must be unique, otherwise the existing variable will be replaced.

Retrieve variables

EndPoint  https://witi.me/api/witime/loadvars.aspx?key=API_KEY&WID=INSTANCE_WID&NAME=VARIABLE_NAME
Method     GET
Return     Previously saved data