Tutorial On Lalamove Webhook

Transcription

Tutorial on Lalamove WebhookLalamove DevelopersSep 2021CONFIDENTIAL

Objectives This deck explains the details of Lalamove’s webhook in Sandbox and Production We usewebhook.site to demonstrate the ideaCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Pre-requisites1.API credentials, commonly known as key AND secret2.Go to Lalamove’ Partner Portal (partnerportal.lalamove.com) 3.Choose either environment (Sandbox or Production)For demonstration, we will use the Sandbox environmentCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Partner Portal1.Navigate to partnerportal.lalamove.com2.Select the country that you are granted access3.Login with the provided credentialsCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Partner Portal4.Click “Developers” at the header bar5.Enter the webhook URL, click “Save”(We use webhook.site for the demonstration)CONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Receiving the webhooks6.For initial connection, make sure to send status 200 even when Lalamove doesn’t sendanything in the body. It is recommended that you send 200 before any complex logic.7.Once the connection is successful, make sure to validate the receive Webhook update’ssignature. (Our Webhook fields are subject to change, so please don’t hard code any fields)8.Whenever there is a status update, our Webhook will try to send the update 10 times within 24hour day window. We will try again with exponential delay in between. By the 10th status update,if we still don’t receive any, we will disable the URL. At this point, the client is responsible for goingback to Partner Portal to update their Webhook URL.9.Our Webhooks may not be sent in the right chronological order, so please make sure to sortthem in the right order based on the timestamp after you’ve received themCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Validating the webhooks1.Check whether this apiKey isthe same2.Insert your API Secret3.Insert your URL path after theroot domain(ex:https://abc.com/lalamove/webhook /lalamove/webhook )4.If two signatures areidentical, then it’s a validLalamove Webhook updateLink to the codeCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

When will Lalamove push message to your webhook?8.You will receive a webhook push if any of the followings happen to your orders:a.Status Change (ORDER STATUS CHANGED )b.Order Amount Changed (ORDER AMOUNT CHANGED ) Priority fee added Add-on fee adjustmentc.Order Replaced (ORDER REPLACED )d.Wallet Balance Changed (WALLET BALANCE CHANGED)CONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Status Change (ORDER STATUS CHANGED)ORDER STATUS CHANGED has 7 different statusesa.ASSIGNING DRIVERb.ON GOINGc.PICKED TIALTutorial on Lalamove Webhook (Sep 2021)

1. ASSIGNING DRIVERNote that this the orderRef id in developers.lalamove.comCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

2. ON GOINGCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

3. PICKED UPCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

4. COMPLETEDCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

5. EXPIREDCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

6. CANCELEDCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

7. REJECTEDCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Order Amount Changed (ORDER AMOUNT CHANGED)CONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Wallet Balance Changed(WALLET BALANCE CHANGED)CONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Cancel-and-Clone Currently, Lalamove cancels an old order and creates a new order by cloning whenpost-match adjustments (ex: driver waiting fees) need to be made for API orders. Previously clients didn’t have an effective way of tracking which new orders werecloned from what. To solve this, we have also created Webhook updates for Cancel-and-Clone orders.We will sequentially send updates of two order statuses (Canceled & Assigning) andORDER REPLACED event to indicate the replacementCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Normal CancellationThis is what clients would see when they cancel the order themselvesNote that the “cancelledReason” is “other” and doesn’t have “remark” fieldCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Step 1: Cancel existing orderNote that it will include the “cancelledReason” and the” remark”: “Canceled by Customer Service”CONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Step 2: Create (Clone) new orderNote that there may be several status updates of new order to match the previous order status (ASSINGING, ON GOING, andetc.)CONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Step 3: ReplacementCONFIDENTIALTutorial on Lalamove Webhook (Sep 2021)

Thank ?Contact partner.support@lalamove.comCONFIDENTIAL

CONFIDENTIAL Tutorial on Lalamove Webhook (Sep 2021) Cancel-and-Clone Currently, Lalamove cancels an old order and creates a new order by cloning when post-match adjustments (ex: driver waiting fees) need to be made for API orders. Previously clients didn’t have an effectiv