You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -51,7 +54,7 @@ You can now use the Facebook channel in your `via()` method, inside the InvoiceP
51
54
52
55
Based on the details you add (text, attachments etc.) will determine automatically the type of message to be sent. For example if you only add `text()` then it will be a basic message; using `attach()` will turn this into a attachment message. Having `buttons` or `cards` will change this to the `Button Template` and `Generic Template` respectivily
53
56
54
-
```php
57
+
```php
55
58
use NotificationChannels\Facebook\FacebookChannel;
56
59
use NotificationChannels\Facebook\FacebookMessage;
57
60
use NotificationChannels\Facebook\Components\Button;
@@ -73,7 +76,10 @@ class InvoicePaid extends Notification
Send a set of cards / items to a user displayed in a carousel (Example is sending a set of links). Note you can also add up to three buttons per card
118
+
107
119
```php
108
120
return FacebookMessage::create()
109
-
->cards([
110
-
Card::create('Card No.1 Title')
111
-
->subtitle('An item description')
112
-
->url('items/'.$this->item[0]->id)
113
-
->image('items/'.$this->item[0]->id.'/image'),
114
-
Card::create('Card No.2 Title')
115
-
->subtitle('An item description')
116
-
->url('items/'.$this->item[1]->id)
117
-
->image('items/'.$this->item[1]->id.'/image')
118
-
//could add buttons using ->buttons($array of Button)
119
-
])
120
-
->to($this->user->fb_messenger_id);
121
+
->to($this->user->fb_messenger_id) // Optional
122
+
->cards([
123
+
Card::create('Card No.1 Title')
124
+
->subtitle('An item description')
125
+
->url('items/'.$this->item[0]->id)
126
+
->image('items/'.$this->item[0]->id.'/image'),
127
+
128
+
Card::create('Card No.2 Title')
129
+
->subtitle('An item description')
130
+
->url('items/'.$this->item[1]->id)
131
+
->image('items/'.$this->item[1]->id.'/image')
132
+
// could add buttons using ->buttons($array of Button)
133
+
]);
121
134
```
122
135
123
136
### Routing a message
@@ -140,12 +153,18 @@ public function routeNotificationForFacebook()
140
153
141
154
### Available Message methods
142
155
143
-
-`to($pageScopedIdOrPhoneNumber, $type)`: (string) Recipient's page-scoped User `id`, `phone_number`, `user_ref`, `post_id` or `comment_id` (as one of the supported types). Phone number supported format `+1(212)555-2368`. **NOTE:** Sending a message to phone numbers requires the `pages_messaging_phone_number` permission. Refer [docs](https://developers.facebook.com/docs/messenger-platform/send-api-reference#phone_number) for more information.
156
+
-`to($recipient, $type)`: (string|array) Recipient's page-scoped User `id`, `phone_number`, `user_ref`, `post_id` or `comment_id` (as one of the supported types - Use `Enums\RecipientType` to make it easier). Phone number supported format `+1(212)555-2368`. **NOTE:** Sending a message to phone numbers requires the `pages_messaging_phone_number` permission. Refer [docs](https://developers.facebook.com/docs/messenger-platform/send-api-reference#phone_number) for more information.
144
157
-`text('')`: (string) Notification message.
158
+
-`isResponse()`: Set `messaging_type` as `RESPONSE`.
159
+
-`isUpdate()`: (default) Set `messaging_type` as `UPDATE`.
160
+
-`isMessageTag($messageTag)`: (string) Set `messaging_type` as `MESSAGE_TAG`, you can refer and make use of the `NotificationChannels\Facebook\Enums\MessageTag` to make it easier to work with the message tag.
145
161
-`attach($attachment_type, $url)`: (AttachmentType, string) An attachment type (IMAGE, AUDIO, VIDEO, FILE) and the url of this attachment
146
162
-`buttons($buttons = [])`: (array) An array of "Call to Action" buttons (Created using `NotificationChannels\Facebook\Components\Button::create()`). You can add up to 3 buttons of one of the following types: `web_url`, `postback` or `phone_number`. See Button methods below for more details.
147
163
-`cards($cards = [])`: (array) An array of item cards to be displayed in a carousel (Created using `NotificationChannels\Facebook\Components\Card::create()`). You can add up to 10 cards. See Card methods below for more details.
148
164
-`notificationType('')`: (string) Push Notification type: `REGULAR` will emit a sound/vibration and a phone notification; `SILENT_PUSH` will just emit a phone notification, `NO_PUSH` will not emit either. You can make use of `NotificationType::REGULAR`, `NotificationType::SILENT_PUSH` and `NotificationType::NO_PUSH` to make it easier to work with the type. This is an optional method, defaults to `REGULAR` type.
165
+
-`isTypeRegular()`: Helper method to create a notification type: `REGULAR`.
166
+
-`isTypeSilentPush()`: Helper method to create a notification type: `SILENT_PUSH`.
167
+
-`isTypeNoPush()`: Helper method to create a notification type: `NO_PUSH`.
0 commit comments