Integrating delivery feedback with Node.js
Now, we'll configure the batch for delivery feedback. At a minimum, you'll need theservice_plan_id
and batch_id
.You can further specify if you'd like only certain phone numbers tracked by listing them under recipients
.Send delivery feedback for a batch
Add the code to your file
Copy and paste the "Send delivery feedback for a message" code into a new file calledsendFeedback.mjs
.Fill in your parameters
- Assign your values to the following parameters:
Parameter | Your value |
---|---|
SERVICE_PLAN_ID | The service plan ID found on your Sinch Customer Dashboard. SMS > APIs > REST configuration. |
API_TOKEN | The API token found on your Sinch Customer dashboard. SMS > APIs > REST configuration > Click Show to reveal your API token. |
BATCH_ID | The batch ID is provided in the response of your previous call to send a batch. Copy the value and paste it in this call to the /delivery_feedback endpoint. |
recipients | Here you'll provide the phone numbers (MSISDNs) for the recipients on whom you'd like to send feedback. These are sent as an array of strings. At least one recipient is requried for proper functionality of this endpoint. |
- Save the file.
Run the code
- Run the following command to send feedback for your batch:
node sendFeedback.mjs
Successful Response
A successful response will be an empty 202 response.
That's it! You've configured this batch to send delivery feedback to Sinch for optimal message routing.
Go backNext steps
- Find other useful code samples in our API reference.
- Check out another tutorial.