File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
src/extensions/message-handlers/ngpvan-optout Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,9 @@ export const available = organization =>
2222 ( hasConfig ( "NGP_VAN_API_KEY" , organization ) ||
2323 hasConfig ( "NGP_VAN_API_KEY_ENCRYPTED" , organization ) ) &&
2424 hasConfig ( "NGP_VAN_APP_NAME" , organization ) &&
25- getConfig ( "MESSAGE_HANDLER" ) . inlcudes ( "auto-optout" ) ;
26- //
25+ getConfig ( "MESSAGE_HANDLERS" ) . inlcudes ( "auto-optout" ) ;
2726
2827/* Sends a request to VAN to place an opt out tag to an individual.
29- * Ideally, we would want to query VAN to see if anyone else is attached
30- * to the cell, but we are unable to do a blind query based soley on
31- * the number.
3228 */
3329export const postMessageSave = async ( {
3430 message,
@@ -38,9 +34,15 @@ export const postMessageSave = async ({
3834} ) => {
3935 if ( ! exports . available ( organization ) ) return { } ;
4036
41- // TODO: Check VAN ID as well.
42- // Maybe be good to check that we also got this contact
43- // from a VAN upload?
37+ // customFields is a JSON object
38+ // Checking for vanID in contact
39+ try {
40+ const c = JSON . stringify ( contact . customFields ) ;
41+ if ( "vanId" in c ) return { }
42+ } catch ( exception ) {
43+ console . log ( "message-handlers | ngpvan-optout ERROR" , exception ) ;
44+ }
45+
4446 if (
4547 message . is_from_contact ||
4648 ! contact ||
You can’t perform that action at this time.
0 commit comments