Overview

Use incoming webhooks to get real-time updates

Pypestream uses webhooks to notify your application when an event happens in your account. Webhooks are particularly useful for asynchronous events like when an end-user is escalated to an agent.

What are webhooks

A webhook enables Pypestream to push real-time notifications to your app. Pypestream uses HTTPS to send these notifications to your app as a JSON payload. You can then use these notifications to execute actions in your backend systems.

Use cases

You can use webhook event notifications to alert your app that:

  • An end-user requested to speak with an agent, so your app can then escalate the conversation to a skilled agent.
  • An end-user is typing, so your app can display a typing indicator to the agent.
  • An end-user sent a message, so your app can display the message to the agent.

Steps to receive webhooks

You can start receiving event notifications in your app using the steps in this section:

  1. Identify the events to monitor and the event payloads to parse.
  2. Create a webhook endpoint as an HTTP endpoint on your local server.
  3. Handle requests from Pypestream by parsing each event object and returning 2xx response status codes.
  4. Test that your webhook endpoint is working properly.
  5. Deploy your webhook endpoint so itโ€™s a publicly accessible HTTPS URL.

Types of events

This is a list of all the types of events we currently send. We may add more at any time, so in developing and maintaining your code, you should not assume that only these types exist.

Availability

Occurs whenever an end-user requests to be escalated.

agents/availability

Attribute

Description

Type

available

Indicates agents availability.

boolean

estimatedWaitTime

Estimated wait time in seconds.

integer

hoursOfOperation

Represents when a program is open or closed.

boolean

queueDepth

Number of chats waiting in the queue.

integer

status

Indicates whether there is an active agent with a chat slot available (online), there are agents logged in, but all their chat slots are full (busy), or all agents on a busy status or are not logged in (offline).

string

WaitTime

Occurs whenever agents are busy.

agents/waitTime

Attribute

Description

Type

estimatedWaitTime

Estimated wait time in seconds.

integer

Escalate

Occurs whenever an end-user is escalated.

conversations/{conversationId}/escalate

Attribute

Description

Type

agentId

Agent identifier.

string

escalationId

Escalation identifier.

string

estimatedWaitTime

Estimated wait time in seconds.

integer

queuePosition

The user position in the chat queue.

integer

status

Status of the conversation (accepted, queued).

string

Type

Occurs whenever an end-user is typing.

conversations/{conversationId}/type

Attribute

Description

Type

typing

Indicate that the end-user is typing.

boolean

Messages

Occurs whenever an end-user sends a message.

conversations/{conversationId}/messages/{messageId}

End

Occurs whenever an end-user ends a conversation.

conversations/{conversationId}/end

Attribute

Description

Type

senderId

Sender identifier.

string