Send SMS form AngularJS Web App - angularjs

I want to send SMS from AngularJS web application. Can anyone tell me how to do this? Please suggest me some reference link or code sample.

One technique you could use is using Firebase and Zapier to help trigger sending your SMS. You can check out this blog post which details how to set something like this up.
The trick is loading data into your firebase when you want the SMS to be triggered like this:
var sendSMSText = function (recipient) {
var smsQueue = new Firebase('https://.firebaseio.com/sms/' + recipient.phone);
smsQueue.set({
name: recipient.name,
phone: recipient.phone
}, onSuccess)
};
Then setup Zapier to trigger a new action when an entry is added to your Firebase database. You can have this action trigger a Twilio SMS message.
Hope that helps.
Disclaimer: I work for Twilio.
not working in angular2

Related

Can we store data coming in console to our database?

I am working with angular,Mongodb,Nodejs,express. simply a Mean stack.
my website is related to shopping where the carts loads dynamically. the products added to cart should be sent as mail to owner.
can we send directly mail? is yes please explain the process how.
if not should be stored in database then how?
So, the question is very unclear here. But I'll try my best to explain all the situations. So that, you don't have to mess with it a lot. I'll explain how you can send a mail to the user using front-end only or using your server.
To send an email to a user, we need to do it on the backend. That means you'll have to write some code in your server for sending the email to your client. As you have a MEAN Stack application, you must be familiar with Node package manager.
npm has a package called nodemailer that can be used for sending emails to the users. But make sure you write those emails in a good manner so that they don't end up in the spam box.
You can install nodemailer using
npm install nodemailer
Here's a sample code from w3schools
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'youremail#gmail.com',
pass: 'yourpassword'
}
});
var mailOptions = {
from: 'youremail#gmail.com',
to: 'myfriend#yahoo.com',
subject: 'Sending Email using Node.js',
text: 'That was easy!'
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
You may also find other and maybe even better alternatives with a simple google search.
Also, i don't think there's any point in storing this data in the database unless you need it for future use. I don't know the flow of your ecommerce application. So, I'll leave this decision for you to take.
And if you want to send the e-mail directly from the front-end, there's a workaround. Sending emails requires a server, but you can use someone's else backend server for this. Basically a BaaS(Backend as a Service). You can check this previously answered question on stackoverflow for more information regarding sending emails directly from the frontend of an application.
How can i send emails without a server ? Only front-end Javascript

Using Lambda/API Gateway in ReactJS

I have a frontend that I designed in ReactJS on AWS Amplify with my Senior Project team and am looking to bring in data from API Gateway. I have a link I deployed that I tested in Lambda on the AWS console which works correctly. I am looking for some guidance on pulling in the data from that url to the frontend to use for a list. I can supply more information if you would like, please let me know what you need and any tips would be great! Thank you.
Assumption :
As mentioned in your question i assume that you already aware how to create API Gateway,deploy API and now you have API gateway url to access rest API.
Fetch data into react :
Example you have following cruds API
GET /students List all students
GET /students/1 Load a studentsby id
POST /students Create a students
PUT /students Update a students
DELETE /students/1 Delete a students by id
Fetching data:
import { API } from 'aws-amplify';
API.get('students', '/students', {}).then(result => {
this.todos = JSON.parse(result.body);
}).catch(err => {
console.log(err);
})
Security :
You need to secure rest API either use API key or Authorizer
https://github.com/vaquarkhan/aws-amplify-workshop-react
https://www.freecodecamp.org/news/going-serverless-with-react-and-aws-amplify-part-2-creating-and-using-serverless-services-d401ba346eeb/
https://gerard-sans.medium.com/create-a-rest-api-integrated-with-amazon-dynamodb-using-aws-amplify-and-vue-5be746e43c22

Checkbox Subscribe for MailChimp with React JS web application

I'm trying to integrate a MailChimp checkbox opt-in feature on an existing React form. The entire site is a React web application. I've been checking around for solutions for hours, but still can't find anything. Any ideas?
You should use Mailchimp 3.0 API
Create an API key here: https://admin.mailchimp.com/account/api/
Send a POST request to the following endpoint with your user data
Endpoint:
https://<data_center>.api.mailchimp.com/3.0/lists/<list_id>/members/
Structure of data to send:
{
"email_address": "urist.mcvankab#freddiesjokes.com",
"status": "subscribed",
"merge_fields": {
"FNAME": "Urist",
"LNAME": "McVankab"
}
}
You can get the data_center for your Mailchimp account when you enter to your dashboard, in the web browser check the URL. If for example, you have https://us7.admin.mailchimp.com/account/api/ your data_center will be us7.
And to obtain the list_id of the list you want your users to subscribe, check the following link as there are several ways to obtain it: Find your list ID
After that you just have to handle the data for your subscriber into React state and send it on your form submit.
For more details, check Mailchimp API 3.0 documentation here

facebook like notifications in React JS and redux with count on notifications icon?

I am developing React based web application. I want to show notifications to user like whenever user receives a friend request and when user confirms his/her friend request etc.
I want to implement a notification system with notifications count exactly like how Facebook has today.
When user clicks on notification icon it should show list of notifications in the Dropdown. I Dono how to implement this and where to start.
Right now, I have add friend functionality when user clicks on + icon marked with red color a friend request will be sent to recipient I am making a call to backed and sending add friend request information as like below
AddFriend(loginId){
var url = window.location.href;
var params = url.split('/');
let friendId = params[3];
let data = {}
data.loginId = loginId;
data.friendId = friendId;
this.props.submitFriendRequest(data)
}
In DB I am storing as
{ "_id" : ObjectId("5a5d883c66bd54040c4808af"), "updatedAt" : ISODate("2018-01-16T05:06:04.997Z"), "createdAt" : ISODate("2018-01-16T05:06:04.997Z"), "requester" : "5a4a0c0c13aa6120980ab532", "recipient" : "5a4d033a2d2c6b2264bf8120", "status" : 1, "__v" : 0 }
Now I want to show a notification to recipient like you have received a friend request from xxx in notification with count like in the picture
I am using Reactjs, redux, material UI, Node.js, Mongodb. Any suggestions on where to start to display notifications? Is there any reactjs npm module for this? I am not expecting the complete code but moreover looking for suggestions. Thanks
It would be great if you can provide your attempts. But if you didn't attempt yet. I guess the only way is establishing a socket connection between your client and server.
You are using redux and node.js. Possibly you can use socket.io for the backend socket connections, and you can use redux-socket.io for establishing the socket connection to your backend socket.io server.
https://github.com/ItsMrAkhil/Anonymous-Chat here is my usage of the same stack that you're using. Hope this will help you.

Which is the right method to handle oauth2.0 done in server using Ionic framework?

I am creating an Ionic app which has multiple 3rd party integration. I already have a java server which does the oauth2 authentication for the 3rd parties and redirect to the callback url in the server itself.
Now my task is to open back the app page after the server callback url is done.
I have tried the following method:
monitoring the url changes in app using ionic and redirect after the successful callback.
Which is the best way to handle this sitn.
Thanks.
Frankly, I haven't done anything like this. But to my mind, you can check ngcordova oauth implementation for ideas.
var browserRef = window.open(your_url);
browserRef.addEventListener("loadstart", function(event) {
//your code
});
browserRef.addEventListener('exit', function(event) {
deferred.reject("The sign in flow was canceled");
});
Check oauth.js source for more details.
Moreover, you can find the sample of using this implementation on this page.
http://mcgivery.com/using-custom-url-schemes-ionic-framework-app/
Above link may help you. If I am thinking correctly what you want?

Resources