-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.blade.php
More file actions
174 lines (162 loc) · 9.39 KB
/
Copy pathdocs.blade.php
File metadata and controls
174 lines (162 loc) · 9.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
@extends('service_views.notify.master_layout')
@section('content')
<div id="docContainer">
<div>
<p class="docintro">
<span>Notify</span> is a <b>Devless</b> service that aids in sending notification to users via SMS,Email and push notification.<br>
This docs shows how to call the Action class methods within your
<b>
<a href="https://docs.devless.io/docs/1.0/service#scripts" target="blank">Devless scripts</a>
</b>
</p>
<hr>
</div>
<h3>SMS</h3>
<p>This service uses <a href="https://www.twilio.com" target="blank">Twilio</a> for sms. Please create a Twilio account and setup your credentials by going to settings</p>
<h5>Send Sms to random Users</h5>
<P>You can send sms to random users using this Action class method <code class="language-php">sms($numbers,$message)</code>. <code class="language-php token function">sms</code> takes two parameters,
<code class="language-php">$numbers</code> which is an array of user numbers and <code class="language-php">$message</code> which is a string of the message to be sent to the users. <br><br>The code below shows how to call the method in your scripts.
</P>
<div class="code">
<pre class="language-php line-numbers"><code>use App\Helpers\Assert as Assert;
$rules
-> onQuery()
-> onUpdate()
-> onDelete()
-> onCreate()
->whenever(true)
->run('notify', 'sms',[['+233540420521'],'Welcome to our world'])
</code>
</pre>
</div>
<h5>Send Sms with User Info</h5>
<P>Send sms with user infomation with this Action class method <br><code class="language-php">smsFromRecords($message, $userInfoColumns, $serviceName, $table, $usersNumberColumn , $conditionArray, $limit)</code>
<ul>
<li><code class="language-php">$message // message to send to users</code></li>
<li><code class="language-php">$userInfoColumns // The column name of the extra user infomation to query from the service table</code></li>
<li><code class="language-php">$usersNumberColumn // The table column that contains users number</code></li>
<li><code class="language-php">$serviceName // The name of the service from whoms tables you would like to query</code></li>
<li><code class="language-php">$table // The table name to query from</code></li>
<li><code class="language-php">$conditionArray //an array of where clause conditions to attach to the query</code></li>
<li><code class="language-php">$limit // Limit of the query results</code></li>
</ul>
<br>The code below shows how to call the method in your scripts.
</P>
<div class="code">
<pre class="language-php line-numbers"><code>use App\Helpers\Assert as Assert;
$rules
-> onQuery()
-> onUpdate()
-> onDelete()
-> onCreate()
->whenever(true)
->run('notify', 'smsFromRecords',['Hello @usernames. your email : @email and number : @phone is not valid',
'username,id,phone,email',
'sample_service','myappuser','phone',['username!=maxwell'],1]);
</code>
</pre>
</div>
<div>
<hr>
</div>
<h3>Email</h3>
<p>This service uses <a href="https://www.sendgrid.com" target="blank">Sendgrid<sup>®</sup></a> for emails. Please create a Sendgrid<sup>®</sup> account and setup your credentials by going to settings</p>
<h5>Send Email to random Users</h5>
<P>You can send email to random users using this Action class method <code class="language-php">email($emails, $subject, $message)</code>.
<code class="language-php token function">email</code> takes three parameters,
<code class="language-php">$emails</code> which is an array of user emails , <code class="language-php">$subject</code> which is the subject of the message to be sent to the users.
<code class="language-php">$message</code> which the message body of the email. <br><br>The code below shows how to call the method in your scripts.
</P>
<div class="code">
<pre class="language-php line-numbers"><code>use App\Helpers\Assert as Assert;
$rules
-> onQuery()
-> onUpdate()
-> onDelete()
-> onCreate()
->whenever(true)
->run('notify', 'email',[['fizzbuzz@gmail.com','foobar@gmail.com'],'just trying','email working hurrey'])
</code>
</pre>
</div>
<h5>send Email with User Info</h5>
<P>Send sms with user infomation with this Action class method <br><code class="language-php">emailFromRecords($mailsubject, $message, $userInfoColumns, $serviceName, $table, $usersEmailColumn, $conditionArray, $limit)</code>
<ul>
<li><code class="language-php">$mailsubject // email subject</code></li>
<li><code class="language-php">$message // message to send to users</code></li>
<li><code class="language-php">$userInfoColumns // The column name of the extra user infomation to query from the service table</code></li>
<li><code class="language-php">$usersEmailColumn // The table column that contains users email</code></li>
<li><code class="language-php">$serviceName // The name of the service from whoms tables you would like to query</code></li>
<li><code class="language-php">$table // The table name to query from</code></li>
<li><code class="language-php">$conditionArray //an array of where clause conditions to attach to the query</code></li>
<li><code class="language-php">$limit // Limit of the query results</code></li>
</ul>
<br>The code below shows how to call the method in your scripts.
</P>
<div class="code">
<pre class="language-php line-numbers"><code>use App\Helpers\Assert as Assert;
$rules
-> onQuery()
-> onUpdate()
-> onDelete()
-> onCreate()
->whenever(true)
->run('notify', 'emailFromRecords',['sample subject','Hello @usernames. your email : @email and number : @phone is not valid',
'username,id,phone,email',
'sample_service','myappuser','email',['id=1'],1]);
</code>
</pre>
</div>
<div>
<hr>
</div>
<h3>Push</h3>
<p>This service uses <a href="https://www.pusher.com" target="blank">Pusher<sup>®</sup></a> for push notification. Please create a Pusher<sup>®</sup> account and setup your credentials by going to settings.</p>
<h5>send Push to random usuers</h5>
<P>You can send push notification to random users using this Action class method <code class="language-php">push($channel, $event,$message)</code>.
<code class="language-php token function">push</code> takes three parameters,
<code class="language-php">$channel</code> which is the channel the user listens to , <code class="language-php">$event</code> which is the event to trigger at the user's end.
<code class="language-php">$message</code> which is the message body of the push notification. <br><br>The code below shows how to call the method in your scripts.
</P>
<div class="code">
<pre class="language-php line-numbers"><code>use App\Helpers\Assert as Assert;
$rules
-> onQuery()
-> onUpdate()
-> onDelete()
-> onCreate()
->whenever(true)
->run('notify', 'push',['my-channel','my-event','sample message'])
</code>
</pre>
</div>
<h5>send Push with User Info</h5>
<P>Send push with user infomation with this Action class method <br><code class="language-php">pushFromRecords($event ,$message, $userInfoColumns, $serviceName, $table, $usersChannelColumn, $conditionArray, $limit)</code>
<ul>
<li><code class="language-php">$event // event to trigger at user's end</code></li>
<li><code class="language-php">$message // message body of push notification</code></li>
<li><code class="language-php">$userInfoColumns // The column names of the extra user infomation to query from the service table</code></li>
<li><code class="language-php">$usersChannelColumn // The table column that contains users push channel ID</code></li>
<li><code class="language-php">$serviceName // The name of the service from whoms tables you would like to query</code></li>
<li><code class="language-php">$table // The table name to query from</code></li>
<li><code class="language-php">$conditionArray //an array of where clause conditions to attach to the query</code></li>
<li><code class="language-php">$limit // Limit of the query results</code></li>
</ul>
<br>The code below shows how to call the method in your scripts.
</P>
<div class="code">
<pre class="language-php line-numbers"><code>use App\Helpers\Assert as Assert;
$rules
-> onQuery()
-> onUpdate()
-> onDelete()
-> onCreate()
->whenever(true)
->run('notify', 'pushFromRecords',['app-passwordChangeEvent',
'Hello @usernames. your email : @email and number : @phone is not valid',
'usernames,id,phone,email','notify','myappuser','pusherid',['username!=james'],1])
</code>
</pre>
</div>
</div>
@endsection