Skip to main content
Webhooks let Heymarket send event notifications to your server when messages, conversations, opt-in state, or call activity changes. Use webhooks for workflows that need to react without polling the REST API.

How delivery works

Heymarket sends an HTTPS POST request to your configured webhook URL. Your receiver should parse the JSON body, validate the token for the webhook configuration, persist what it needs, and return a 2xx response quickly. If processing may take more than a short moment, acknowledge the webhook first and move the work to a queue. Make processing idempotent with type plus a stable ID inside event_data when one is present, so repeated deliveries do not create duplicate work.

Steps

1

Create an HTTPS receiver

Create a public HTTPS endpoint that accepts POST requests with JSON bodies.
webhook receiver
2

Configure the webhook URL

Add the HTTPS endpoint in the Heymarket app webhook settings. Store the webhook verification token from that configuration and compare it with the token value in every payload.
For app configuration steps, see the Heymarket Help Center article: Getting Started with Webhooks.
Webhook URLs are configured in the Heymarket app. The public REST API reference documents webhook payloads, but it does not provide a webhook-management endpoint.
3

Handle the event payload

Webhook payloads include type, id, token, and event_data.
The envelope id is a UUID generated for the event, not a webhook configuration ID. Every webhook configuration that receives the same event receives the same id, so pair it with type to deduplicate deliveries.The event_data shape depends on the event type. Message events send a message object, conversation events send a conversation object, and opt-in or opt-out events send an unsubscribe-state object.

Event types

Webhook type values include:
  • message_sent
  • message_recieved
  • chat_reassigned
  • chat_closed
  • chat_opened
  • chat_pending
  • chat_transferred
  • target_opt_out
  • target_opt_in
  • target_double_opt_in
  • target_double_opt_restricted
  • incoming_call
The current API spelling is message_recieved. Match that exact value when branching on inbound-message events.

Message event payload

message_sent and message_recieved events send a message object as event_data. For the full field list, see the webhook event reference. When you write a receiver for message events, plan for these behaviors:
  • Most fields are omitted when empty. Treat a missing key as an empty or zero value rather than requiring it.
  • user identifies the sending team member and is omitted on incoming messages. Use its presence to tell outbound from inbound.
  • super is the conversation ID. The full conversation is also embedded as conversation.
  • Group messages set targets with the individual phone numbers and sender with the sending number. On those events target is a single |-separated string.
  • status and raw_error apply to outbound messages. For group messages, per-target failures arrive in target_errors, keyed by target.
  • hidden marks a message whose content is withheld, so content fields can be empty even though the message exists.
The flagged field appears in the message schema but is not populated on webhook deliveries.

Example

An inbound SMS delivers a payload like this.

Security

  • Keep webhook URLs private.
  • Validate the token value before processing the event.
  • Do not expose webhook URLs in client-side code or public repositories.
  • Use separate webhook URLs for separate environments.
  • Log event type, webhook ID, and processing outcome for troubleshooting.

Webhooks concept

Understand where webhooks fit with REST API calls.

Messages reference

Send follow-up messages after webhook events.

Webhook event reference

Review the generated webhook payload schema.