| 1234567891011121314151617181920212223242526 |
- import axios from 'axios'
- // Find your Service Plan ID and API Token at dashboard.sinch.com/sms/api/rest
- // Find your Sinch numbers at dashboard.sinch.com/numbers/your-numbers/numbers
- const SERVICE_PLAN_ID = 'a1ac863dc82e4075b816a22d8f75a9c7'
- const API_TOKEN = 'eb521456941c4fce861e254fb669f743'
- const SINCH_NUMBER = '+12085686210'
- const TO_NUMBER = '+16789901017'
- const REGION = 'us'
- const SINCH_URL = 'https://' + REGION + '.sms.api.sinch.com/xms/v1/' + SERVICE_PLAN_ID + '/batches'
- const headers = { 'Content-Type': 'application/json', Authorization: 'Bearer ' + API_TOKEN }
- const payload = JSON.stringify({
- from: SINCH_NUMBER,
- to: [TO_NUMBER],
- body: 'Programmers are tools for converting caffeine into code. We just got a new shipment of mugs! Check them out: https://tinyurl.com/4a6fxce7!'
- })
- // axios
- // .post(SINCH_URL, payload, { headers })
- // .then((response) => console.log(response.data))
- // .catch((error) => console.error('There was an error!', error.response))
- axios
- .get(`https://${REGION}.sms.api.sinch.com/xms/v1/${SERVICE_PLAN_ID}/inbounds`, { headers })
- .then((response) => console.log(response.data))
- .catch((error) => console.error('There was an error!', error.response))
|