Using Webhooks

Webhooks enable BrightBack to call a script on your server when an event has occurred in the BrightBack cancel experience. Webhook events can be used to trigger an action in your billing system or activate another internal workflow.  

Implementing webhooks with BrightBack 

BrightBack events are sent as POST requests to any static endpoint.  Events can be distributed to multiple endpoints or directed to a single URL. 
In order to use webhooks with cancel experience alerts the BrightBack team will need to know the endpoint (URL) you would like alerts to be directed at and what alerts should be activated.  BrightBack will provide a shared secret that will be used to sign all events prior to transmission using the HMAC sha1 algorithm.  The signature will be placed in request header:“X-Hub-Signature” and should be used to verify whether or not the event payload is authentic. 

Event Types

Event Name
Type
Viewed cancel page
page_loaded
Deflected 
deflect
Canceled
cancel
Sent an email
send_email
Followed a link
link
Initiated a chat
intercom_chat
Accepted an offer
accepted_offer
Saved
save
Added to watch list
watchlist

Cancel

The following fields are returned when a Cancel webhook is received.

HTTPS POST

Top level attributes
Name
Type
Description
delivery_attempts
integer
Number of delivery attempts for the notification
created_at
datetime
When a“notification” was created for for the event.
subscription_id
string
The id of the subscription. 
url
string
The endpoint URL for this webhook
first_sent_at
datetime
First delivery attempt date/time ?

Attributes under“data” object

Name
Type
Description
type
string
The type of event that caused this webhook to fire
id
string
Unique identifier for the object
app_id
string
Brightback App ID where the event came from
session_id
string
Brightback unique session_id of the event
name
string
The component related to the event. This can be used to identify where on the cancel page this event came from (e.g. confirm_cancel modal)
timestamp
timestamp(iso)
Date/time of the event
context
object(context)
Data about the user visiting the Brightback page
context.ip
string
IP address of the user
context.locale
string
End user locale 
context.timezone
string
End user timezone
context.user_agent
string
Details about end user device and browser
context.url
string
URL that the end user visited (Brightback page)
context.referrer
string
URL that the end user came from
survey
object(survey)
Details about the Brightback page exit survey
survey.reason_for_leaving
list(reason)
The reason that the customer cancelled
survey.competition
string
The competitor that the customer indicated in the survey
survey.sentiment
integer
The likelihood of the customer to return
survey.feedback
string
The feedback comment from the survey form
survey.selected_reason
string
Reason code
survey.display_reason
string
The reason that the customer cancelled
survey.brightback_reason
string
The Brightback benchmarking reason code
segments
object
Container object for all of the segment dimensions
segments.<segment_name>
boolean
The true/false value of a specific segment dimension
fields
object
Container object for all of the standard and custom fields
fields.<field_name>
any type
Field name key-value pair

Sample payload:

{
  "data" : {
    "type" : "cancel",
    "id" : "f3274761-eb5f-4ae1-ba7a-fd407c4e3edf",
    "app_id" : "abc123",
    "session_id" : "WpOBXpLMbd",
    "name" : "confirm_cancel",
    "timestamp" : "2019-12-04T19:07:44.217Z",
    "context" : {
      "ip" : "76.14.4.98",
      "locale" : "en-US",
      "timezone" : "America/Los_Angeles",
      "user_agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
      "url" : "https://app.brightback.com/example_company/cancel/WpOBXpLMbd",
      "referrer" : "https://subscribe.example-company.com/services/cancelflow/brightback.php"
    },
    "survey" : {
      "reason_for_leaving" : [ {
        "name" : "reason_for_leaving",
        "value" : "i_cant_afford_it.1551254326",
        "tier" : "tier0",
        "lives_on" : "tier0"
      } ],
      "competition" : "None",
      "sentiment" : 9,
      "feedback" : "Javi testing",
      "confirmation" : true,
      "selected_reason" : "i_cant_afford_it.1551254326",
      "display_reason" : "I can't afford it",
      "brightback_reason" : "budget_downsize",
      "__path" : "/layout/cards/0d7b5526-f926-4c7b-b263-1156e80d0c44/provides"
    },
    "segments" : { 
      "is_monthly" : true
    },
    "fields" : {
      "standard.Owner Email" : "bibi423534@dispostable.com",
      "cancel.context.referrer" : "",
      "cancel.app_id" : "JE5owl9D4P",
      "standard.First Purchase Date" : "2019-12-02T11:57:09.000Z",
      "cancel.context.locale" : "en-US",
      "cancel.first_name" : "Bibiana",
      "cancel.context.timezone" : "America/Los_Angeles",
      "standard.Organization Name" : "Acme Co",
      "cancel.account.created_at" : 1575287829,
      "standard.Owner Last Name" : "Vivien2",
      "cancel.save_return_url" : "https://service.example-company.com/web/",
      "integrations.intercom.app_id" : "vqcjqxff",
      "cancel.context.user_agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
      "cookie" : "15e7957b-16fc-4c30-a4f4-628b05ccd3c5",
      "cancel.last_name" : "Vivien2",
      "cancel.account.company_name" : "Acme Co",
      "cancel.account.plan" : "trial_1usd_border_trump_monthly_print_digitalsub",
      "session_id" : "WpOBXpLMbd",
      "standard.Domain" : "www.example-company.com",
      "cancel.email" : "bibi423534@dispostable.com",
      "cancel.account.billing_id" : "Azyw4IRjUpC3B1tlk",
      "cancel.context.url" : "https://subscribe.example-company.com/services/cancelflow/brightback.php?token=YTo0OntzOjU6ImVtYWlsIjtzOjI2OiJiaWJpNDIzNTM0QGRpc3Bvc3RhYmxlLmNvbSI7czoyOiJ0cyI7aToxNTc1NDU3ODU0O3M6Njoic2VjcmV0IjtzOjEwOiJlcG9jaHRpbWVzIjtzOjE1OiJzdWJzY3JpcHRpb25faWQiO3M6MTc6IkF6eXc0SVJqVXBDM0IxdGxrIjt9",
      "cancel.timestamp" : "2019-12-04T19:07:15.275Z",
      "standard.Instance ID" : "Azyw4IRjUpC3B1tlk",
      "cancel.cancel_confirmation_url" : "https://service.example-company.com/web/cancel-confirmation",
      "cancel.custom.cf_how_did_you_hear_about_us" : "",
      "standard.Owner First Name" : "Bibiana",
      "cancel.account.internal_id" : "Azyw4IRjUpC3B1tlk",
      "cancel.account.company_domain" : "www.example-company.com"
    }
  },
  "delivery_attempts" : 1,
  "created_at" : "2019-12-04T19:07:44.258Z",
  "subscription_id" : "QvoNe7gWwm",
  "url" : "https://subsapi-dev.example-company.cloud/brightback/action",
  "first_sent_at" : "2019-12-04T19:07:44.330Z",
  "id" : "4ec087cd-69f6-4892-9f3a-aa311b990372",
  "type" : "event"
}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us