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
AttributeDescriptionType
availableIndicates agents availability.boolean
estimatedWaitTimeEstimated wait time in seconds.integer
hoursOfOperationRepresents when a program is open or closed.boolean
queueDepthNumber of chats waiting in the queue.integer
statusIndicates 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
AttributeDescriptionType
estimatedWaitTimeEstimated wait time in seconds.integer

Escalate

Occurs whenever an end-user is escalated.

conversations/{conversationId}/escalate
AttributeDescriptionType
agentIdAgent identifier.string
escalationIdEscalation identifier.string
estimatedWaitTimeEstimated wait time in seconds.integer
queuePositionThe user position in the chat queue.integer
statusStatus of the conversation (accepted, queued).string

Type

Occurs whenever an end-user is typing.

conversations/{conversationId}/type
AttributeDescriptionType
typingIndicate 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
AttributeDescriptionType
senderIdSender identifier.string