Unofficial Alexa Skill for AfterShip Shipment Tracking Platform
The is an unofficial skill meaning it should only be used for personal usage. I do not have any affiliations with AfterShip or Amazon.
This skill provides package tracking information using the AfterShip shipment tracking platform API. The information provided is location-aware based on the Echo device configured location country and postal code. All of the location information is normalized via the Google Maps Geocoding API.
It is leveraging the Alexa Skills Kit Command Line Interface (ASK CLI) to streamline the deployment process.
You need an AWS account and an Amazon developer account to create an Alexa Skill.
In order to use the ASK CLI features to automatically deploy and manage your Lambda skill, ensure that you have AWS credentials set up with the appropriate permissions on the computer to which you are installing ASK CLI, as described in Set Up Credentials for an Amazon Web Services (AWS) Account.
You will have to install the latest ASK CLI, and then configure it:
npm install -g ask-cli
ask configure
By default, the ASK CLI deploys the skill resources in the us-east-1
region. You will need to change your deploy region based on the skill language you are planning to use. You should refer to the table below, based on the smart home multi-languages development guidelines:
Skill Language | Endpoint Region | Deploy Region |
---|---|---|
English (CA), English (US) | North America | us-east-1 |
English (UK) | Europe | eu-west-1 |
English (IN) | India | eu-west-1 |
English (AU) | Far East | us-west-2 |
To change your deploy region, update the awsRegion
skill infrastructure user config parameter in ask-resources.json
.
It is important to note that AfterShip has moved the tracking API functionality behind a paywall. That functionality requires at least the Essentials plan unless your existing account was migrated to the legacy Starter plan.
To get tracking information, you need to generate a AfterShip API Key associated to your account.
Access to Google Maps API requires to setup a key. This access is necessary for the skill location features. The total number of requests for this skill should easily be covered by the free tier level. To set this up, please follow these instructions:
-
Create a project or use an existing one on your Google Cloud Resource Manager Console. If this is your first time using this service, you will be prompted to setup your account by agreeing to Google Cloud Platform's terms and conditions and provide billing information.
-
Once the project is selected, enable the Google Maps Geocoding API and Google Maps Time Zone API services.
-
Create an API key credentials by clicking the "Create credentials" blue button and selecting "API key" from the dropdown menu.
The new API key created will show in a popup window as displayed below. Click on the restrict button to customize it.
In the key restrictions section, add the two APIs services enabled above in the API restrictions tab. Unfortunately, there isn't much that can be done to restrict the key even at the application level though Google is strongly recommending to do so.
-
Configure the deployment parameters in
ask-resources.json
:-
Required Parameters
Parameter Description AfterShipApiKey
Your AfterShip API key. GoogleMapsApiKey
Your Google Maps API key. -
Optional Parameters
Parameter Description LambdaDebug
Set to true
to enable debug modeLocationDefaultCountry
Set your country if not located in the United States. LocationDefaultTimezone
Set your time zone TZ name if not located in the US/Eastern time zone. AfterShipDaysPastDelivered
Number of days since delivered packages are still included in results. (Default: 1) AfterShipDaysSearch
Number of days since tracking created search query limit. AfterShip only stores data up to 90 days. (Default: 30) AfterShipNoteTagging
Filter tracking items based on specific tag(s) part of the AfterShip note field. This can be a regexp. (Default: disabled) AfterShipTrackingCountLimit
Maximum number of tracking items returned per query. (Default: 20) NotificationMuteFootnotes
Mute skill location related error notifications at the end of the speech output. (Default: disabled) NotificationScheduleRate
Proactive event notification check schedule rate in minutes. (Default: 30)
-
-
Deploy the skill and all AWS resources in one step:
ask deploy
-
In your Alexa app, go to More > Skills & Games, find the AfterShip List Sync skill under Your Skills > Dev tab and enable it. Make sure that the "Device Country and Postal Code", and "Alexa Notifications" permissions are granted.
-
That should be it! Now, just say to your favorite Echo device: "Alexa, ask aftership where's my stuff". If you have any errors, please check the lambda function logs. If necessary, you can enable the function debug mode, to increase the log verbosity, by setting the
LambdaDebug
deployment parameter totrue
.