OneSignalDevelopers / ngosi

Share your slides with a QR code
https://ngosi.io
MIT License
9 stars 5 forks source link

Webinar demo #67

Closed iAmWillShepherd closed 2 years ago

iAmWillShepherd commented 2 years ago

Solution

This PR is for a demo I did on transactional email; it's only here for demonstrative purposes.

Testing

  1. Set the ONESIGNAL_APP_ID environment variable to your Onesignal app's ID ([link to keys]())
  2. Set the ONESIGNAL_API_KEY environment variable to your app's API key
  3. Start the app, yarn dev
  4. Navigate to the account page, http://localhost:3000/account
  5. Click the Update button
  6. Verify that you received an email indicating your account has been updated (note the email will go to the same address you used to login)

Resources

Create a device request
curl --request POST \
  --url https://onesignal.com/api/v1/players \
  --header 'content-type: application/json; charset=utf-8' \
  --data '{"app_id": "app_id","device_type": 11,"identifier": "email@example.com","external_user_id": "123456"}'
Update device tags request
curl --request PUT \
  --url https://onesignal.com/api/v1/apps/app_id/users/external_id \
  --data 'Content-Type: application/json; charset=utf-8{"tags": {"firstName": "Mike","lastName": "Jones","purchaseAmount": "57.98","purchaseDate": "1643670478163","totalPurchaseAmount": "8460.54"}}'
Send email request
curl --request POST \
  --url https://onesignal.com/api/v1/notifications \
  --header 'authorization: Basic API_key' \
  --header 'content-type: application/json; charset=utf-8' \
  --data '{"app_id": "app_id","template_id": "template_id","email_subject": "Demo","include_email_tokens": ["mikejones@example.com"]}'
vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/onesignaldevs/ngosi/Dbk2ZDQHcXyRdmcgGt2iXA2h3wEb
✅ Preview: https://ngosi-git-webinar-demo-onesignaldevs.vercel.app

iAmWillShepherd commented 2 years ago

Closing because this work was never meant to be integrated into the project: it was for the webinar I hosted on transactional email.