Webhook

The Webhook is a event notification system that are ableto capture the actions in Huggy Platform and forward directly to your system. You can be notified about:

  • Opening and closure of chats
  • Contacts creation
  • Received messages of your customers/contacts
  • Received platforms entities messages, like bots, URA, or agents;

If you'd like to receive notifications from our webhook on your system, visit how to use Webhook and learn more.

To receive the notifications, you need to set up a notification URL in the Huggy panel, and the desired events must be enabled to be triggered in your webhook settings.

The webhook events available are listed below. All events are optional and can be selected in Huggy platform, therefore, select those who are more relevant for the experience that you are trying to create.

Notifications

Event of notification Description
receivedMessage Received messages on platform (the webhook will notify events of chats that are in automatic or queue).
receivedAllMessage Get all messages received by a chat contact.
createdChat When a chat is created by any channel.
agentEntered When a agent enters in a chat.
closedChat When a chat is finalized.
answeredChatForm Depreciated.
createdCustomer When a new contact is created in Huggy platform.
startedWidgetAttendance Started when data request is enabled in Huggy Chat. This event is started when the customer inform the data and initialize the attendance.
startedAutomationFlow When a chat is initialized in a channel that are using a flow.
finishedAutomationFlow When a flow that was executing in a chat are finalized.
sendedAllMessage All messages sent by an agent.

Note: An event is returned like a Message List. When a specific event is sent to your system, it can brings other events belonging to the chain events in addition to the event data. This indicates that between an action and its completion, other events can be or not be triggered.

Variations on events

  • If exists an input and/or output flow
  • Type received messages
    • Intelligent layer: receivedMessage (when a chat its in automatic or in queue).
    • Human layer: receivedMessage; receivedALLMessage.
  • If some flow interaction exists to close a chat.

Some notification examples

Action Notification Note
Chat creation createdChat 1. Created by an agent. It doesn’t have interaction with a flow.
Chat creation createdChat, receivedAllMessage 1. The customer creates a new attendance and sent a message to the chat. 2. After creation there is flow interaction.
Chat creation createdChat, receivedAllMessage, startedAutomationFlow 1. The customer create a new chat. 2. The customer sends a message. 3. A flow was initialized in the chat.
Chat finished startedAutomationFlow, receivedAllMessage, finishedAutomationFlow, closedChat 1. An output flow with a feedback action is executed. 2. The customer answers the feedback. 3. The chat is closed.
Chat finished sendedAllMessage, closedChat 1. An agent informs to a client that the chat will be closed. 2. A tabulation is set when this chat is closed. 3. The chat is closed.
Chat finished agentEntered, closedChat 1. An agent enters in a chat (taking it from the queue, for example). 2. The chat is closed.

Note: Consider that the events only will be notified if they were marked in the webhook settings of Huggy platform.

Understanding the Event Format

Notice that messages is an array and can contain various objects.

{
    "time": 1562964573,
    "messages": {
        "createdChat": [
            {
                "id": 19632057,
                "channel": "widget",
                "situation": null,
                "department": false,
                "customer": {
                    "id": 2574725,
                    "name": "L8883851555530376861",
                    "mobile": null,
                    "phone": null,
                    "email": null,
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                },
                "company": {
                    "id": "15691"
                }
            }
        ],
        "receivedMessage": [
            {
                "id": "424921135",
                "body": "Hello, Kivya!",
                "is_internal": false,
                "is_email": false,
                "sender": {
                    "id": 2574725,
                    "name": "L8883851555530376861",
                    "mobile": null,
                    "phone": null,
                    "email": null,
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                },
                "senderType": "widget",
                "receiver": false,
                "receiverType": "agent",
                "file": null,
                "channel": "widget",
                "customer": {
                    "id": 2574725,
                    "name": "L8883851555530376861",
                    "mobile": null,
                    "phone": null,
                    "email": null,
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                },
                "chat": {
                    "id": 19632057,
                    "channel": "widget",
                    "situation": "auto",
                    "department": false,
                    "customer": {
                        "id": 2574725,
                        "name": "L8883851555530376861",
                        "mobile": null,
                        "phone": null,
                        "email": null,
                        "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                    }
                },
                "send_at": "2019-07-12 17:49:33",
                "read_at": null,
                "company": {
                    "id": "15691"
                }
            }
        ]
    },
    "token": "8187ce0c2e5d0aefd626fa4999f62974"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

Note: This action was executed with the receivedAllMessages event disabled in Huggy platform. If this event was selected, you would receive the notifications of createdChat, receivedAllMessage, receivedMessage. The chat is only created when the customer sends the first message or when an agent opens a chat with a customer, but in this case only the createdChat and the receivedMessage events are triggered. The receivedAllMessage is started regardless of being automatic messages.

Event Properties

Properties Type Description
messages Array An array containing data. It can have one or more events.

messages.createdChat

  • createdChat
    • Event reported by Webhook.
Properties Type Description
id Int Chat ID.
channel String Channel that the customer has contacted.
situation String In attendance, in queue, finalized etc.
department String Chat department.

createdChat.customer

  • customer
    • Event object createdChat. Contains customer data.
Properties Type Description
id Int Chat ID.
name String Contact name.
mobile String Contact mobile.
phone String Contact phone.
email String Contact email.
photo String Contact profile photo URL address.

createdChat.company

  • company
    • Event object createdChat. Contains the company ID.
Properties Type Description
id Int Company ID that the chat was created.

messages.receivedMessage

  • receivedMessage
    • Event reported by webhook.
Properties Type Description
id Int Contact ID.
body String Message sent by customer.
is_internal String If the message was sent to an internal chat.
is_email String If the message was received by email.

receivedMessage.sender

  • sender
    • Event object reveivedMessage. It has the message sender data (contact/customer).
Properties Type Description
id Int Contact ID.
name String Contact name.
mobile String Contact mobile.
phone String Contact phone.
email String Contact email.
photo String Contact profile photo URL address.

messages.receivedMessage

  • receivedMessage
    • Communicated event by webhook.
senderType String Channel that the customer has contacted.
receiver String Contact name.
receiverType String Type of person that receiving the message. For example: Agent, Contact.
file String If was sent some file.
channel String Used channel.

receivedMessage.customer

  • customer
    • Event object receivedMessage. It has customer information (contact/customer).
Properties Type Description
id Int Contact ID.
name String Contact name.
mobile String Contact mobile.
phone String Contact phone.
email String Contact email.
photo String Contact profile photo URL address.

receivedMessage.chat

  • chat
    • Event object receivedMessage. It has chat information.
Properties Type Description
id Int Contact ID.
chanel String Channel name.
situation String If the chat is in attendance, in queue, finalized, etc.
department Int Channel department number.

receivedMessage.chat.customer

  • chat.customer
    • Event object receivedMessage. Return contact info.
Properties Type Description
id Int Contact ID.
mobile String Contact mobile.
phone String Contact phone.
email String Contact email.
photo String Contact profile photo URL address.

messages.receivedMessage

  • receivedMessage
    • Communicated event by webhook.
send_at String Received message date.
read_at String Last reading date.

receivedMessage.company

  • company
    • Event object createdChat. Contains the company ID.
Properties Type Description
id Int Company ID that the chat was created.

Received messages notification

The receivedAllMessage event, in this example, is an event notified by the action of sending a message. The customer contacted the Kivya agent by Huggy Chat. There’s no automated events that happen after the customer contacts.

{
    "time": 1562879079,
    "messages": {
        "receivedAllMessage": [{
            "id": "423747203",
            "body": "Hello Kivya, how are you?",
            "is_internal": false,
            "is_email": false,
            "sender": {
                "id": 2574725,
                "name": "L8883851555530376861",
                "mobile": null,
                "phone": null,
                "email": null,
                "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
            },
            "senderType": "widget",
            "receiver": {
                "id": 39708,
                "name": "Kivya",
                "mobile": "5575999999999",
                "phone": "5575999999999",
                "email": "kivya@test.com",
                "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
            },
            "receiverType": "agent",
            "file": null,
            "channel": "widget",
            "customer": {
                "id": 2574725,
                "name": "L8883851555530376861",
                "mobile": null,
                "phone": null,
                "email": null,
                "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
            },
            "chat": {
                "id": 19585255,
                "channel": "widget",
                "situation": "in_chat",
                "department": false,
                "customer": {
                    "id": 2574725,
                    "name": "L8883851555530376861",
                    "mobile": null,
                    "phone": null,
                    "email": null,
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                }
            },
            "send_at": "2019-07-11 18:04:39",
            "read_at": null,
            "company": {
                "id": "15691"
            }
        }]
    },
    "token": "8817ce0c2e5d0aefd626fa4989f63974"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

To improve your event browsing experience, you can click in any event above, or click on title of any event for back to the event lists.

receivedMessage

Notification of received message

The Huggy sends to your system a notification whenever a message is received.

{
    "time": 1524155854,
    "messages": {
        "receivedMessage": [
            {
                "id": "51917884",
                "body": "teste",
                "is_internal": false,
                "is_email": false,
                "sender": {
                    "id": 419689,
                    "name": "Charles",
                    "mobile": "557599999999",
                    "phone": "557599999999",
                    "email": "charles@teste.com",
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                },
                "senderType": "widget",
                "receiver": false,
                "receiverType": "agent",
                "file": null,
                "channel": "widget",
                "customer": {
                    "id": 419689,
                    "name": "Charles",
                    "mobile": "557599999999",
                    "phone": "557533333333",
                    "email": "charles@teste.com",
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                },
                "chat": {
                    "id": 2932424,
                    "channel": "widget",
                    "situation": "wait_for_chat",
                    "department": 11445
                },
                "send_at": "2018-04-19 13:37:34",
                "read_at": null,
                "company": {
                    "id": "6618"
                }
            }

        ]
    },
    "token": "132ce76c7abb1154f01ebc0d508162e4"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

Note: You will by communicated with a receivedMessage event when a chat is in queue or in automatic. If an agent queues a chat and you are notified with a event agentEntered, the option of automatic distribution will be enabled in panel. For clearer experience with webhook, make sure of this.

receivedAllMessage

Notification of all messages received and/or sent

The Huggy send to your system a notification whenever a message is received. Unlike the receivedMessage event, this event will be started regardless if the message is automatic (Bot, URA…) or no (from customer/agents).

{
    "time": 1524146026,
    "messages": {
        "receivedAllMessage": [
            {
                "id": "51917874",
                "body": "I!",
                "is_internal": false,
                "is_email": false,
                "sender": {
                    "id": 419688,
                    "name": "Johann",
                    "mobile": "557599999999",
                    "phone": "557533333333",
                    "email": "johann@test.com",
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                },
                "senderType": "widget",
                "receiver": {
                    "id": 8792,
                    "name": "Kivya Aguiar",
                    "mobile": "557533333333",
                    "phone": "557599999999",
                    "email": "kivya@teste.com",
                    "photo": "https://cdn.pzw.io/03a3e95e84ccd5f19140ce6db54f71f1.jpg"
                },
                "receiverType": "agent",
                "file": null,
                "channel": "widget",
                "customer": {
                    "id": 419688,
                    "name": "Johann",
                    "mobile": "557599999999",
                    "phone": "557533333333",
                    "email": "johann@test.com",
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                },
                "chat": {
                    "id": 2932423,
                    "channel": "widget",
                    "situation": "in_chat",
                    "department": 11445
                },
                "send_at": "2018-04-19 10:53:45",
                "read_at": null,
                "company": {
                    "id": "9999"
                }
            }
        ]
    },
    "token": "132ce76c7abb1154f01ebc0d508162e4"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

createdChat

Open attendance notification

The Huggy send to your system a notification whenever a chat is created.

{
    "time":1501188213,
    "messages":{
        "createdChat": [{
            "id": 999999,
            "channel": "widget",
            "situation": null,
            "department": false
        }],
        "token":"16f64ecc76487a909e278766071b4da8"
    }
}
1
2
3
4
5
6
7
8
9
10
11
12

closedChat

Attendance notification closed

The Huggy send to your system a notification whenever a chat is closed by an agent, customer or automatically. The automatically close can be configured in panel settings.

{
    "time": 1524141031,
    "messages": {
        "closedChat": [
            {
                "id": 2932410,
                "channel": "widget",
                "closed_at": "2018-04-19 09:30:30",
                "tabulation": false,
                "company": {
                    "id": "9999"
                }
            }
        ]
    },
    "token": "132ce76c7abb1154f01ebc0d508162e4"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

createdCustomer

Contact notification created

The Huggy send to your system a notification whenever a contact (customer) is created.

{
    "time": 1524151261,
    "messages": {
        "createdCustomer": [
            {
                "id": 1202213,
                "name": "charles",
                "mobile": "5575999999999",
                "phone": "557533333333",
                "email": "charles@teste.com",
                "photo": "no_photo",
                "company": {
                    "id": "9999"
                }
            }
        ]
    },
    "token": "132ce76c7abb1154f01ebc0d508162e4"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

startedWidgetAttendance

Notification od new event by Huggy Chat

The Huggy send to your system a notification whenever an attendance is created by Huggy Chat.

{
    "time": 1524151902,
    "messages": {
        "startedWidgetAttendance": [
            {
                "id": 18516008,
                "name": "Charles",
                "mobile": "557599999999",
                "phone": "557533333333",
                "email": "charles@teste.com",
                "widget": "2008",
                "company": {
                    "id": "9999"
                }
            }
        ]
    },
    "token": "132ce76c7abb1154f01ebc0d508162e4"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

startedAutomationFlow

Notification that flow has started

The Huggy send to your system a notification whenever a flow is initialized.

{
    "time": 1530109996,
    "messages": {
        "startedAutomationFlow": [
            {
                "chatID": 99999,
                "lastActionID": 99999,
                "companyID": "99999",
                "flowID": 99999,
                "context": {
                    "SYSTEM.TIME_HELLO": "Good Morning",
                    "SYSTEM.CHAT_ID": "99999",
                    "SYSTEM.DEPARTMENT_NAME": "",
                    "SYSTEM.DEPARTMENT_ORDER": "",
                    "SYSTEM.CLIENT_NAME": "",
                    "SYSTEM.CLIENT_FIRST_NAME": "",
                    "SYSTEM.CLIENT_SECOND_NAME": "",
                    "SYSTEM.CLIENT_NUMBER": "",
                    "SYSTEM.COMPANY_NAME": "Test",
                    "SYSTEM.COMPANY_NUMBER": "9999999999",
                    "SYSTEM.AGENT_NAME": "",
                    "SYSTEM.AGENT_MAIL": "",
                    "SYSTEM.AGENT_PHONE": ""
                },
                "company": {
                    "id": "99999"
                }
            }
        ]
    },
    "token": "871457dcsvffe7d7d4177e47fr4d4sd74"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

finishedAutomationFlow

Flow notification finalized

The Huggy send to your system a notification whenever a flow is finalized.

{
    "time": 1530110012,
    "messages": {
        "finishedAutomationFlow": [
            {
                "chatID": 99999,
                "lastActionID": 99999,
                "companyID": "99999",
                "flowID": 99999,
                "context": {
                    "SYSTEM.TIME_HELLO": "bom dia",
                    "SYSTEM.CHAT_ID": "99999",
                    "SYSTEM.DEPARTMENT_NAME": "",
                    "SYSTEM.DEPARTMENT_ORDER": "",
                    "SYSTEM.CLIENT_NAME": "",
                    "SYSTEM.CLIENT_FIRST_NAME": "",
                    "SYSTEM.CLIENT_SECOND_NAME": "",
                    "SYSTEM.CLIENT_NUMBER": "",
                    "SYSTEM.COMPANY_NAME": "Teste",
                    "SYSTEM.COMPANY_NUMBER": "9999999999",
                    "SYSTEM.AGENT_NAME": "",
                    "SYSTEM.AGENT_MAIL": "",
                    "SYSTEM.AGENT_PHONE": "",
                    "hash_fluxo.pergunta": "Response"
                },
                "company": {
                    "id": "99999"
                }
            }
        ]
    },
    "token": "871458dcsvffe7d7d4177e47fr4d4sd74"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

sendedAllMessage

Notification of message send by Huggy platform

The Huggy send to your system a notification whenever a message is sent by an agent of your company.

{
    "time": 1563279612,
    "messages": {
        "sendedAllMessage": [
            {
                "id": "270925787",
                "body": "Yes, let's go!",
                "is_internal": false,
                "is_email": false,
                "sender": {
                    "id": 33980,
                    "name": "Amanda Muniz",
                    "mobile": "557599999999",
                    "phone": "557533333333",
                    "email": "Amanda@test.com",
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                },
                "senderType": "agent",
                "receiver": {
                    "id": 1841823,
                    "name": "John",
                    "mobile": "557599999999",
                    "phone": "557533333333",
                    "email": "john@doe.com",
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                },
                "receiverType": "widget",
                "file": null,
                "channel": "agent",
                "customer": {
                    "id": 1841823,
                    "name": "john",
                    "mobile": "557599999999",
                    "phone": "557533333333",
                    "email": "john@doe.com",
                    "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                },
                "chat": {
                    "id": 13120639,
                    "channel": "widget",
                    "situation": "in_chat",
                    "department": false,
                    "customer": {
                        "id": 1841823,
                        "name": "john",
                        "mobile": "557599999999",
                        "phone": "557533333333",
                        "email": "john@doe.com",
                        "photo": "https://c.pzw.io/img/avatar-user-boy.jpg"
                    }
                },
                "send_at": "2019-07-16 09:20:11",
                "read_at": null,
                "company": {
                    "id": "11721"
                }
            }
        ]
    },
    "token": "af0adcc862a9343c1d44e24cbdc0194c"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60