The following 4 dependencies are required before you can use the Phone Number Verification Service
1) A Syniverse Developer Community Account
If you don’t have one then sign up at https://developer.syniverse.com/
2) Enabled the Service Offering for Phone Number Verification
If you haven’t already enabled this then go to the Service Offerings tab and click on the link for Phone Number Verification.
Expand > Subscriptions and then click Subscribe…. When subscribing you need to select the account to use from the drop down..
Screenshot showing how to subscribe to the Phone Number Verification Service
3) An Application with the SDC Gateway Services, Media Storage, Event Subscription Services, Notification Services, Batch Automation and Phone Number Verification Services APIs enabled.
You can either create a new Application using the New application button, or edit an existing one to enable the correct APIs.
Once enabled then it is recommended to regenerate the Access Token. This option can be found by expanding > Auth Keys..
screen shot showing how to enable APIs when creating an application
4) The Access Token for the Application.
This
can be found by clicking the wheel in the top right hand side of the
Application, as shown below. This will then list the keys including the Access Token.
If you have made any changes to the enabled APIs then re-generate the Keys using the Edit and then Re-Generate options.
screen shot showing to access Access Token for an application
5) Set up a Delivery Configuration for the notifications
Do this by going to the Event Manager tab and then to Delivery Configurations, click on new Delivery Configuration, and then populate the Name and Address fields (the address is the URL where the notification should be sent to). The other properties can be left the same. If you are just trying out the service you may want to try https://requestb.in/ to create an endpoint to receive the notifications.
There is also the option of creating a scheduled delivery. This will deliver the notifications as a file on a regular basis. More details of how to set this up are in the Event Manager User Guide.
Once you
have created the delivery configuration then you can read the delivery
configuration from the table of delivery configurations on the
Delivery Configurations page. The Id is typically a 3 digit number in the delivery configuration
id field.
Screen shot showing a Delivery Configuration
You can use cURL statements to create, schedule and download the results for the batch job,. Examples cURL statements are provided on the Examples page.
However it is easier use a script or code, due to the number of steps involved.
If you are familiar with Python you can quickly get up and running using our code samples on Github.
Go to the Batch Monitoring Repository where you will find both a Readme with instructions and two simple python scripts which you can use to batch subscribe, or unsubscribe, to monitor phone numbers from an input file. An example input file is also included. Only two changes are needed to the script, which is to add your Access Token and Delivery configuration.
You can access the code by either downloading the code from the website, or by forking the repository and then cloning the fork to your local workspace.
The code is tested in python 2.7.13 and uses the Requests library. If you don’t already have Requests already installed, then instructions on how to install are here.
The results from running the example for subscribing phone numbers are shown below.
Output files are compressed, but are automatically uncompressed by the Python code.
python.exe PycharmProjects/BatchMonitor/BatchMonitor-Example.py Starting Engines Creating file in Media Storage create file response status code: 201 mss create response body: {"file_id":"a3b7ac34-9d86-4656-8376-cc480edc9887","company-id":"589","file_status":"CREATED","file_uri":"https://api.syniverse.com/mediastorage/v1/files/a3b7ac34-9d86-4656-8376-cc480edc9887/content","file_version":1,"file_checksum":0,"file_size":0,"file_fullsize":2000000,"creation_time":"2017-07-28T09:01:45.571 +0000","modified_time":"2017-07-28T09:01:45.571+0000","file_retention_time":30,"expire_time":"2017-08-27T09:01:45.571+0000"} Uploading input file to Media Storage upload response status code: 201 upload response: Scheduling the Number Monitoring batch job in Batch Automation Scheduling response status code: 201 Scheduling response: {"schedule":{"id":"d4d5226b-e98c-4e82-9fa4-15b06afbaec8","jobId":"NIS-Monitor-v2","name":"NISMonitor","inputFileId":"a3b7ac34-9d86-4656-8376-cc480edc9887","fileRetentionDays":30,"scheduleRetentionDays":30,"outputFileNamingExpression":"DS1-NIS-Monitor-output.txt","outputFileFolder":"/opt/apps/aba/output","outputFileTag":null,"jobRuntimeContext":{"subscribedestinationid":"676","subscribeevents":"all"}}} Waiting 20s for job to complete Retrieving batch job execution details Get batch job details status code: 200 Get batch job details response: {"executions":[{"id":"c75317e5-af74-43e5-be22-784c2ade6e7d","scheduleDetail":{"id":"d4d5226b-e98c-4e82-9fa4-15b06afbaec8","jobId":"NIS-Monitor-v2","name":"NISMonitor","inputFileId":"a3b7ac34-9d86-4656-8376-cc480edc9887","fileRetentionDays":30,"scheduleRetentionDays":30,"outputFileNamingExpression":"DS1-NIS-Monitor-output.txt","outputFileFolder":"/opt/apps/aba/output","outputFileTag":null,"jobRuntimeContext":{"subscribedestinationid":"676","subscribeevents":"all"}},"status":"COMPLETE","statusReason":"Final Status","startTimestamp":1501232512949,"statusUpdateTimestamp":1501232518795,"outputFileId":"dedfb622-1f2f-415e-af69-10ba9f7bfd91","errorDetailFileId":"EMPTY_FILE","retryFileId":"EMPTY_FILE","recordSuccessCount":3,"recordRetryCount":0,"recordErrorCount":0,"outputFileURI":"https://api.syniverse.com/mediastorage/v1/files/dedfb622-1f2f-415e-af69-10ba9f7bfd91/content","errorDetailFileURI":"EMPTY_FILE","retryFileURI":"EMPTY_FILE"}]} Downloading the Output file Download output status code: 200 Download output response: +18132633923,subscribe,"deactivation_event,porting_event,truedisconnect_event",2017-07-28T09:01:56.321Z[UTC] +18135041457,subscribe,"deactivation_event,porting_event,truedisconnect_event",2017-07-28T09:01:56.316Z[UTC] +18139551760,subscribe,"deactivation_event,porting_event,truedisconnect_event",2017-07-28T09:01:56.322Z[UTC] Process finished with exit code 0
The results can be checked by going to the Event Manager Subscriptions page which will provide a list of all the new subscriptions you have created, as well as any existing subscriptions.
Sample output when running the Unsubscribe script is
python.exe PycharmProjects/BatchMonitor/BatchMonitorUnsubscribe-Example.py Starting Engines Creating file in Media Storage create file response status code: 201 mss create response body: {"file_id":"08fb7e20-3dae-47ea-936f-469a17b9d6ac","company-id":"589","file_status":"CREATED","file_uri":"<a href="https://api.syniverse.com/mediastorage/v1/files/08fb7e20-3dae-47ea-936f-469a17b9d6ac/content" ,"file_version":1,"file_checksum":0,"file_size":0,"file_fullsize":2000000,"creation_time":"2017-07-28t09:04:44.063"="">https://api.syniverse.com/mediastorage/v1/files/08...</a> +0000","modified_time":"2017-07-28T09:04:44.063 +0000","file_retention_time":30,"expire_time":"2017-08-27T09:04:44.063 +0000"} Uploading input file to Media Storage upload response status code: 201 upload response: Scheduling the Number Monitoring Unsubscribe batch job in Batch Automation Scheduling response status code: 201 Scheduling response: {"schedule":{"id":"cf5850e3-147a-4e7c-b32b-914b264fb501","jobId":"NIS-Unsubscribe-v2","name":"NISUnsubscribe","inputFileId":"08fb7e20-3dae-47ea-936f-469a17b9d6ac","fileRetentionDays":30,"scheduleRetentionDays":30,"outputFileNamingExpression":"DS1-NIS-Unsubscribe-output.txt","outputFileFolder":"/opt/apps/aba/output","outputFileTag":null,"jobRuntimeContext":{}}} Waiting 20s for job to complete Retrieving batch job execution details Get batch job details status code: 200 Get batch job details response: {"executions":[{"id":"74e8e09f-224b-482e-a7f4-8189dedb939e","scheduleDetail":{"id":"cf5850e3-147a-4e7c-b32b-914b264fb501","jobId":"NIS-Unsubscribe-v2","name":"NISUnsubscribe","inputFileId":"08fb7e20-3dae-47ea-936f-469a17b9d6ac","fileRetentionDays":30,"scheduleRetentionDays":30,"outputFileNamingExpression":"DS1-NIS-Unsubscribe-output.txt","outputFileFolder":"/opt/apps/aba/output","outputFileTag":null,"jobRuntimeContext":{}},"status":"COMPLETE","statusReason":"Final Status","startTimestamp":1501232693409,"statusUpdateTimestamp":1501232698016,"outputFileId":"ba0f8c70-ab93-44eb-bd7a-2c0b2e14b0f7","errorDetailFileId":"EMPTY_FILE","retryFileId":"EMPTY_FILE","recordSuccessCount":3,"recordRetryCount":0,"recordErrorCount":0,"outputFileURI":"https://api.syniverse.com/mediastorage/v1/files/ba0f8c70-ab93-44eb-bd7a-2c0b2e14b0f7/content","errorDetailFileURI":"EMPTY_FILE","retryFileURI":"EMPTY_FILE"}]} Downloading the Output file Download output status code: 200 Download output response: +18132633923,unsubscribe,ALL,2017-07-28T09:04:55.564Z[UTC] +18135041457,unsubscribe,ALL,2017-07-28T09:04:55.559Z[UTC] +18139551760,unsubscribe,ALL,2017-07-28T09:04:55.564Z[UTC] Process finished with exit code 0
If you prefer Java then you may want to use our Java code sample. This is also available on Github here.