Different reminders for each attendee - google-calendar-api

I'd like to know if is possible to send different notification for each attendee of the event.
here is my code:
'attendees' => array(
array('email' => $event["email"], 'displayName' => $event["displayname"]),
array('email' => $event["email2"], 'displayName' => $event["displayname2"]),
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
'overrides' => array(
//array('method' => 'email', 'minutes' => 60),
array('method' => 'popup', 'minutes' => 1440),
array('method' => 'popup', 'minutes' => 10),
),
),
),

There seems to be no mention of customized calendar notifications mentioned Reminders and Notifications. As far as the docs go:
Notifications
Calendar support the following notification types:
Event creation: a new event has been added to one of the user's calendars.
Event change: an event the user is invited to has been modified by the organizer.
Event cancellation: an event the user was invited to has been cancelled.
Attendee response: an attendee to an event created by the user has changed their response status.
Agenda: a list of all the events in the user’s calendar, sent at the start of the day.
The user can decide what notifications to enable per calendar and the delivery method for each notification type. These settings are not shared with other users. Similar to default reminders, they’re accessible through the CalendarList collection.
Delivery mechanisms
The delivery methods offered by Google Calendar are:
Pop-up. These are supported on mobile platforms and on web clients.
Email sent by the server.
SMS. These are only available for Google
Apps for Work, Education, and Government customers.

Related

How to use file upload option in WooCommerce payment gateway admin options?

I am developing a plugin to integrate a payment gateway in WooCommerce. I have done one before.
But in this one, I need to upload a key file in gateway settings and that is used to hash the data before making payment request to related portal.
I have following code which allows to choose file, but I doubt this is working in the back end.
'sandbox_pvt_key' => array(
'title' => __( 'Test Private Key', 'woocommerce-custom-gateway' ),
'type' => 'file',
'desc_tip' => true,
'description' => __( 'Please upload the test private key file; this is needed in order to test payment.', 'woocommerce-custom-gateway' ),
'default' => '',
),
The output looks like the following:
Can anybody lemme know if this is supported option in the gateway settings? If not, can anybody guide me on how I can customize it via some hook/filters or any other way.
This can be achieved in the process_admin_options()
public function process_admin_options() {
$this->upload_key_files();
$saved = parent::process_admin_options();
return $saved;
}
private function upload_key_files() {
//handle uploads here
}

add to Google calendar option cut some description content off

We have coded a PHP page building the content of a calendar event. It is a mix of static and dynamic content for different parts of the email including the Description. When I receive the email in Gmail, the Add Calendar is displayed in the email header. An .ICS file is also attached. If I click on Add to calendar, the content of the description is incomplete, the length of content is OK, the problem is not coming from that point. When I open the attached ICS file in Outlook or Hotmail, the content is ok. If I'm adding the event into Google calendar importing the ICS, the content is ok too. But this method is too complicated for my end users.
Any suggestion? Is someone has already met this issue?
Regards
A solution for your issue might be to use the Google Calendar API so you can create calendar events and afterwards add them to the users' calendars.
You should follow the steps from the PHP Quickstart and here a couple of code snippets that create a calendar and then an event with Google Calendar API:
Create a calendar
$calendar = new Google_Service_Calendar_Calendar();
$calendar->setSummary('your_calendar_summary');
$calendar->setTimeZone('your_time_zone');
$createdCalendar = $service->calendars->insert($calendar);
Create an event (you can customize the parameters to your liking)
$event = new Google_Service_Calendar_Event(array(
'summary' => 'your_event_summary',
'location' => 'your_event_location',
'description' => 'your_event_description',
'start' => array(
'dateTime' => 'your_start_date',
'timeZone' => 'your_time_zone',
),
'end' => array(
'dateTime' => 'your_date_time',
'timeZone' => 'your_time_zone',
),
'recurrence' => array(
'RRULE:FREQ=DAILY;COUNT=2'
),
'attendees' => array(
array('email' => 'atendee1#example.com'),
array('email' => 'atendee2#example.com'),
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
));
$calendarId = 'primary';
$event = $service->events->insert($calendarId, $event);
printf('Event created: %s\n', $event->htmlLink);
If you want to integrate the Google Calendar service with Gmail you can check these links that might help you:
Email Markup;
Gmail API Reference;
Furthermore, you can read more about the Calendar API here:
Google Calendar PHP Quickstart;
Google Calendar Add Events.

How to use Telegram bot api to send messages after blocking?

I'm create a telegram bot with https://github.com/php-telegram-bot/core/. Bot is located in Russia. In some reason, Russian authority block some Telegram features and my bot can't send messages to registered users. To avoid it, I'm trying to use proxy as
$telegram = new Longman\TelegramBot\Telegram('API-key', 'Bot-name');
$data = [
'chat_id' => 12345678,
'text' => 'Test message',
];
Longman\TelegramBot\Request::setClient(new \GuzzleHttp\Client([
'base_uri' => 'https://api.telegram.org',
'proxy' => 'socks5://218.248.73.193:1080',
'verify' => false,
]));
$result = Longman\TelegramBot\Request::sendMessage($data);
but it return Telegram returned an invalid response! Please review your bot name and API key.
How to avoid this problem? Thanks in advance!
Longman\TelegramBot\Request::setClient(new \GuzzleHttp\Client([
'base_uri' => 'https://api.telegram.org',
'proxy' => 'socks5://218.248.73.193:1080',
'verify' => false,
'timeout' => 10, //*****add this
]));

Why is Display Name is not Showing in Calendar Event Attendees?

I'm successfully retrieving Calendar Event Attendees using the following code gist:
require_once __DIR__ . '/vendor/autoload.php';
putenv("GOOGLE_APPLICATION_CREDENTIALS=" . __DIR__ . '/mt-service-account.json');
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->setApplicationName("APP NAME");
$client->setSubject("<APPROPRIATE_USER_EMAIL>");
$client->setScopes([
'https://www.googleapis.com/auth/calendar'
]);
$calendarService = new Google_Service_Calendar($client);
$optParams = array(
'singleEvents' => true,
'orderBy' => 'startTime'
);
$events = $calendarService->events->listEvents('<APPROPRIATE_CALENDAR_ID>', $optParams);
foreach ($events->getItems() as $event) {
print_r($event->getAttendees());
}
However, as can be seen in the response, no Display Name is returned.
Array
(
[0] => Google_Service_Calendar_EventAttendee Object
(
[additionalGuests] =>
[comment] =>
[displayName] =>
[email] => johnsmith#domain.com
[id] =>
[optional] =>
[organizer] =>
[resource] =>
[responseStatus] => needsAction
[self] =>
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
)
)
The attendee in question is a Contact of the event creator and the Contact's name and email appear in the type assist field when creating an event.
UPDATE NB Events are not created via API. They're created via Google Calendar (i.e. in browser). The attendees are added by typing the attendee's name in the Add Attendee field (Google type-assist found the Contact). The aim is to retrieve programmatically (i.e. with API) event details created by our G Suite Calendar users
I cant see how you are creating the event in question but my guess is that when the event was created and the attendee added their display name was not inserted as an optional parameter.
Events.insert
attendees[].displayName string The attendee's name, if available. Optional. writable
When events are creted via the Google Calendar web view you just add a users Email address. In the event that said user is a Gmail account then Google can guess the display name. In the event it is not a Gmail account then google has no way of knowing what the users name is there for you end up with a display name of null.
attendees": [
{
"email": "lme#gmail.com",
"displayName": "Linda Lawton",
"organizer": true,
"self": true,
"responseStatus": "accepted"
},
{
"email": "ll#meAtWork.com",
"responseStatus": "needsAction"
}

Bundle for notifications in Symfony2

I want to include notifications, e.g. for forum threads. A user shall retrieve notifications if there are any new posts to a forum thread. Another example would be the notifications on Facebook, e.g. where you're notified of new comments on your posts or pictures.
Is there a notification bundle for Symfony2 that you can recommend for implementing such a function?
I came up with the Sonata NotificationBundle but I am unsure if this is what I really need. When I look at the usage examples it looks as if this would provide a email notification function
// retrieve the notification backend
$backend = $container->get('sonata.notification.backend');
// create and publish a message
$backend->createAndPublish('mailer', array(
'from' => array(
'email' => 'no-reply#sonata-project.org',
'name' => 'No Reply'
),
'to' => array(
'myuser#example.org' => 'My User',
'myuser1#example.org' => 'My User 1',
),
'message' => array(
'html' => '<b>hello</b>',
'text' => 'hello'
),
'subject' => 'Contact form',
));
or a logging function
$this->get('sonata.notification.backend')->createAndPublish('logger', array(
'level' => 'debug',
'message' => 'Hello world!'
));
Can you confirm/recommend the usage of that bundle? Or can you recommend any other?
Good news:
NotificationBundle from GeniusesOfSymfony
https://github.com/GeniusesOfSymfony/NotificationBundle
Proper documentation will probably be published soon.
(on-going discussion here: https://github.com/GeniusesOfSymfony/WebSocketBundle/issues/4#issuecomment-81829513)
I've already tested a similar bundle created by them (WebSocketBundle) which also provides real-time-interaction and it works really great. The documentation is also very good.
I recommend that you "star" the project on github. You can also create an issue to ask about the current status of the project.
I'm searching for the same library now, and also found https://github.com/namshi/notificator
Didn't use it yet, but it has 130 stars today, so probably will try it.
You can achieve this with sonata notification bundle.
You will need to create custom consumer class as described here
https://sonata-project.org/bundles/notification/3-x/doc/reference/usage.html#custom-consumer
You can try this Bundle: NotificationsBundle
It's a simple implementation for Pusher that provides a real time data proadcast.

Resources