Integrating delivery feedback with Node.js

Now, we'll configure the batch for delivery feedback. At a minimum, you'll need the service_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 called sendFeedback.mjs.

Fill in your parameters

  1. Assign your values to the following parameters:
ParameterYour value
SERVICE_PLAN_IDThe service plan ID found on your Sinch Customer Dashboard. SMS > APIs > REST configuration.
API_TOKENThe API token found on your Sinch Customer dashboard. SMS > APIs > REST configuration > Click Show to reveal your API token.
BATCH_IDThe 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.
recipientsHere 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.
  1. Save the file.

Run the code

  1. Run the following command to send feedback for your batch:
    Copy
    Copied
    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 back

Next steps

We'd love to hear from you!
Rate this content:
Still have a question?
 
Ask the community.