daisycrego / jbg-admin

Admin app for Jill Biggs Group follow-up boss event management
1 stars 0 forks source link

Review specs from Dan #1

Closed daisycrego closed 3 years ago

daisycrego commented 3 years ago

Dan:

  1. Alerting us when we get a Zillow inquiry on a contact that is already in the database.
    • Sending an email alert to notify this has happened (maybe use webhook to make this quicker)
    • Creating a separate UI view to show only these zillow exceptions with an ability to set their exception status (No action, Notified Zillow, Zillow Approves Exemption, Zillow Rejected Exemption)
  2. Allow to sort Zillow Flex inquiries by # days since last update updating zillow is manual and the update date in this app will need to be set manually as well.
  3. Provide UI to compare Zillow Flex Status in Zillow vs Status in FUB
    • Zillow status will be manually updated in this app, FUB status to be refreshed and pulled in.
daisycrego commented 3 years ago

These are the webbook events supported in the FUB API (https://docs.followupboss.com/reference#webhooks-2):

peopleCreated, peopleUpdated, peopleDeleted, peopleTagsCreated, peopleStageUpdated,peopleRelationshipCreated,peopleRelationshipUpdated,peopleRelationshipDeleted

Looking at peopleUpdated, which seems the closest:

One or more of the following fields are updated in a person:

Name name firstName lastName Emails emails Phone Numbers phones Address addresses Price price Background background Assigned Agent assignedTo assignedUserId Assigned Lender assignedLenderName assignedLenderId Contacted contacted Stage stage stageId Lead Source source sourceUrl Tags tags Custom Fields Relationship is created, updated, or deleted

It's really not clear to me what these events, "Zillow inquiry"s, look like, where they appear, in the FUB API.

daisycrego commented 3 years ago

I need to figure out where a Zillow inquiry is going to appear in the data. Is it going to appear as an event? It doesn't seem like the webhook is going to work, because we can't expect the peopleUpdated webhook to encapsulate the zillow inquiries, and that was the closest one. So , hopefully, a zillow inquiry is an event in the API, let's see.

daisycrego commented 3 years ago

There actually might be a good webhook: eventsCreated (under the People Events section here:

eventsCreated: People perform an action on your IDX website, e.g. view a property.

We can register a webhook for a peopleEvent, and then we can filter all of those events to get only the zillow events, and then send out the emails accordingly. This way we might not have to use a scheduled process approach, we can take advantage of the webhook. But we should probably have the ability to do a manual sync run as well. To make sure the data is up to date.

daisycrego commented 3 years ago

Webhook best practices

Setup your system to de-couple receiving webhook events from fetching the resource specified in the event. For example--the web service that receives events could record the event in a local database table. A separate backend process could be created to monitor this table for new rows and fetch the resource specified in the event. By separating these, the web service that handles receiving webhooks is doing less and is, therefore less likely to fail. The process that processes the events can contain all the complex logic to fetch the resource from Follow Up Boss, reconcile with your local system and mark the event as processed in the table. If this process fails or breaks it can be debugged independently of the web service. The table that stores events is the source of truth as to what webhook events have been received and processed.

Debugging webhooks

Since webhooks require a publicly accessible URL to function they can be hard to test from your local machine. It is recommended that you use a service like Request Bin when you are developing your webhook endpoints.

Common webhook mistakes

daisycrego commented 3 years ago

So from what I understand, the webhooks are going to alert the system that there is new events data, but the system still has to check whether the event is relevant (Zillow, related to an existing lead), and then decide whether or not to send out an email with the alert.

We will just create a webhook endpoint for eventsCreated, so that whenever an event is created, we will get a POST to that endpoint. The endpoint is responsible for filtering the event and, if the event is a Zillow inquiry, it will send an email and also create some kind of record in the system (we're not going to be storing all events, just the ones that we send emails about?)

daisycrego commented 3 years ago

More Details

Inbound Lead Number Tracking is valued

daisycrego commented 3 years ago

Todo (5/26)

New Lead vs. Existing Lead - FUB API

How can we tell from the FUB API if an event is related to a new lead or an existing lead? We need to also be capturing all of the new lead created events, so we have our own DB to refer to for when a lead came into our system. This way, when a person comes in with an event, we can know whether this is a new person (from the POV of FUB) or an existing lead being updated.

So we need to set up a web hook to track all new leads as they come in AND we need to pull all of the existing leads (as of some 0 day) so that we have our own internal lead database which is also synced with the live database through (1) WebHook and (2) manual sync option. That way, we can compare all of the incoming leads to the new leads to understand if this is a new lead or not.

daisycrego commented 3 years ago

Feedback

It may not be necessary to store all of this information in another database. Could actually make everything worse. Keep looking at the API. The /person endpoint might actually be sufficient.

created: This is going to be good enough for us, actually. We can also do a simple check if created exists AND created===updated AND created != today (not sure if the last check is really necessary but I would have some concerns about never actually checking the day). We need to get a better understanding of the format of the date information - how much of an exact timestamp am I getting? We could go down an a "within the last hour" comparison even, but only if that's the kind of time data FUB is storing. I do really like the elegance of created exists AND created===updated, this is a new lead. Otherwise it's not a new lead. Simple as that. Never need to actually see what the time is. Don't need to worry about narrowing things down to the minute/hour/day, etc. We just have to rely on FUB correctly updating that updated field. I do like that final check though, created=== today. Probably a smart move just to add that final check.

daisycrego commented 3 years ago

Revised Todo (5/26)