diff --git a/.env.dist b/.env.dist index 5c60548..91e43ee 100644 --- a/.env.dist +++ b/.env.dist @@ -45,6 +45,11 @@ MESSAGES_EMOJI='MESSAGES_EMOJI' WHATSAPP_STICKER_ID='WHATSAPP_STICKER_ID' WHATSAPP_STICKER_URL='WHATSAPP_STICKER_URL' +# Identity Insights +INSIGHT_NUMBER='INSIGHT_NUMBER' +SIM_SWAP_PERIOD='SIM_SWAP_PERIOD' +IDENTITY_INSIGHTS_API_HOST='api-eu.vonage.com' + # NI INSIGHT_NUMBER='INSIGHT_NUMBER' INSIGHT_CALLBACK_URL='INSIGHT_CALLBACK_URL' diff --git a/identity-insights/get-all-insights.py b/identity-insights/get-all-insights.py new file mode 100644 index 0000000..33ad878 --- /dev/null +++ b/identity-insights/get-all-insights.py @@ -0,0 +1,45 @@ +import os +from os.path import dirname, join +from pprint import pprint + +from dotenv import load_dotenv + +dotenv_path = join(dirname(__file__), "../.env") +load_dotenv(dotenv_path) + +VONAGE_APPLICATION_ID = os.environ.get("VONAGE_APPLICATION_ID") +VONAGE_PRIVATE_KEY = os.environ.get("VONAGE_PRIVATE_KEY") +INSIGHT_NUMBER = os.environ.get("INSIGHT_NUMBER") +IDENTITY_INSIGHTS_PURPOSE = os.environ.get("IDENTITY_INSIGHTS_PURPOSE") +IDENTITY_INSIGHTS_API_HOST = os.environ.get("IDENTITY_INSIGHTS_API_HOST") + +from vonage import Auth, HttpClientOptions, Vonage +from vonage_identity_insights import ( + EmptyInsight, + IdentityInsightsRequest, + IdentityInsightsResponse, + InsightsRequest, + SimSwapInsight, +) + +client = Vonage( + auth=Auth( + application_id=VONAGE_APPLICATION_ID, + private_key=VONAGE_PRIVATE_KEY, + ), + http_client_options=HttpClientOptions(api_host=IDENTITY_INSIGHTS_API_HOST), +) + +request = IdentityInsightsRequest( + phone_number=INSIGHT_NUMBER, + purpose=IDENTITY_INSIGHTS_PURPOSE, + insights=InsightsRequest( + format=EmptyInsight(), + sim_swap=SimSwapInsight(period=240), + original_carrier=EmptyInsight(), + current_carrier=EmptyInsight(), + ), +) + +response: IdentityInsightsResponse = client.identity_insights.requests(request) +pprint(response) diff --git a/identity-insights/get-current-carrier.py b/identity-insights/get-current-carrier.py new file mode 100644 index 0000000..76c4f44 --- /dev/null +++ b/identity-insights/get-current-carrier.py @@ -0,0 +1,37 @@ +import os +from os.path import dirname, join +from pprint import pprint + +from dotenv import load_dotenv + +dotenv_path = join(dirname(__file__), "../.env") +load_dotenv(dotenv_path) + +VONAGE_APPLICATION_ID = os.environ.get("VONAGE_APPLICATION_ID") +VONAGE_PRIVATE_KEY = os.environ.get("VONAGE_PRIVATE_KEY") +INSIGHT_NUMBER = os.environ.get("INSIGHT_NUMBER") +IDENTITY_INSIGHTS_API_HOST = os.environ.get("IDENTITY_INSIGHTS_API_HOST") + +from vonage import Auth, HttpClientOptions, Vonage +from vonage_identity_insights import ( + EmptyInsight, + IdentityInsightsRequest, + IdentityInsightsResponse, + InsightsRequest, +) + +client = Vonage( + auth=Auth( + application_id=VONAGE_APPLICATION_ID, + private_key=VONAGE_PRIVATE_KEY, + ), + http_client_options=HttpClientOptions(api_host=IDENTITY_INSIGHTS_API_HOST), +) + +request = IdentityInsightsRequest( + phone_number=INSIGHT_NUMBER, + insights=InsightsRequest(current_carrier=EmptyInsight()), +) + +response: IdentityInsightsResponse = client.identity_insights.requests(request) +pprint(response) diff --git a/identity-insights/get-format-insight.py b/identity-insights/get-format-insight.py new file mode 100644 index 0000000..60f717d --- /dev/null +++ b/identity-insights/get-format-insight.py @@ -0,0 +1,37 @@ +import os +from os.path import dirname, join +from pprint import pprint + +from dotenv import load_dotenv + +dotenv_path = join(dirname(__file__), "../.env") +load_dotenv(dotenv_path) + +VONAGE_APPLICATION_ID = os.environ.get("VONAGE_APPLICATION_ID") +VONAGE_PRIVATE_KEY = os.environ.get("VONAGE_PRIVATE_KEY") +INSIGHT_NUMBER = os.environ.get("INSIGHT_NUMBER") +IDENTITY_INSIGHTS_API_HOST = os.environ.get("IDENTITY_INSIGHTS_API_HOST") + +from vonage import Auth, HttpClientOptions, Vonage +from vonage_identity_insights import ( + EmptyInsight, + IdentityInsightsRequest, + IdentityInsightsResponse, + InsightsRequest, +) + +client = Vonage( + auth=Auth( + application_id=VONAGE_APPLICATION_ID, + private_key=VONAGE_PRIVATE_KEY, + ), + http_client_options=HttpClientOptions(api_host=IDENTITY_INSIGHTS_API_HOST), +) + +request = IdentityInsightsRequest( + phone_number=INSIGHT_NUMBER, + insights=InsightsRequest(format=EmptyInsight()), +) + +response: IdentityInsightsResponse = client.identity_insights.requests(request) +pprint(response) diff --git a/identity-insights/get-original-carrier.py b/identity-insights/get-original-carrier.py new file mode 100644 index 0000000..db271fb --- /dev/null +++ b/identity-insights/get-original-carrier.py @@ -0,0 +1,37 @@ +import os +from os.path import dirname, join +from pprint import pprint + +from dotenv import load_dotenv + +dotenv_path = join(dirname(__file__), "../.env") +load_dotenv(dotenv_path) + +VONAGE_APPLICATION_ID = os.environ.get("VONAGE_APPLICATION_ID") +VONAGE_PRIVATE_KEY = os.environ.get("VONAGE_PRIVATE_KEY") +INSIGHT_NUMBER = os.environ.get("INSIGHT_NUMBER") +IDENTITY_INSIGHTS_API_HOST = os.environ.get("IDENTITY_INSIGHTS_API_HOST") + +from vonage import Auth, HttpClientOptions, Vonage +from vonage_identity_insights import ( + EmptyInsight, + IdentityInsightsRequest, + IdentityInsightsResponse, + InsightsRequest, +) + +client = Vonage( + auth=Auth( + application_id=VONAGE_APPLICATION_ID, + private_key=VONAGE_PRIVATE_KEY, + ), + http_client_options=HttpClientOptions(api_host=IDENTITY_INSIGHTS_API_HOST), +) + +request = IdentityInsightsRequest( + phone_number=INSIGHT_NUMBER, + insights=InsightsRequest(original_carrier=EmptyInsight()), +) + +response: IdentityInsightsResponse = client.identity_insights.requests(request) +pprint(response) diff --git a/identity-insights/get-sim-swap.py b/identity-insights/get-sim-swap.py new file mode 100644 index 0000000..718263d --- /dev/null +++ b/identity-insights/get-sim-swap.py @@ -0,0 +1,39 @@ +import os +from os.path import dirname, join +from pprint import pprint + +from dotenv import load_dotenv + +dotenv_path = join(dirname(__file__), "../.env") +load_dotenv(dotenv_path) + +VONAGE_APPLICATION_ID = os.environ.get("VONAGE_APPLICATION_ID") +VONAGE_PRIVATE_KEY = os.environ.get("VONAGE_PRIVATE_KEY") +INSIGHT_NUMBER = os.environ.get("INSIGHT_NUMBER") +SIM_SWAP_PERIOD = os.environ.get("SIM_SWAP_PERIOD") +IDENTITY_INSIGHTS_API_HOST = os.environ.get("IDENTITY_INSIGHTS_API_HOST") + +from vonage import Auth, HttpClientOptions, Vonage +from vonage_identity_insights import ( + IdentityInsightsRequest, + IdentityInsightsResponse, + InsightsRequest, + SimSwapInsight, +) + +client = Vonage( + auth=Auth( + application_id=VONAGE_APPLICATION_ID, + private_key=VONAGE_PRIVATE_KEY, + ), + http_client_options=HttpClientOptions(api_host=IDENTITY_INSIGHTS_API_HOST), +) + +request = IdentityInsightsRequest( + phone_number=INSIGHT_NUMBER, + purpose='FraudPreventionAndDetection', + insights=InsightsRequest(sim_swap=SimSwapInsight(period=SIM_SWAP_PERIOD)), +) + +response: IdentityInsightsResponse = client.identity_insights.requests(request) +pprint(response)