I have created a method to update all email signatures in my company.
It works, the signature is automatically set on new emails but for replies/forwards there is no signature.
Is it possible to update the signature for reply/forward?
My code:
public function updateSignature(User $user, string $email, string $newSignature): SendAs
{
// Executes the request with the address of its own user
$this->client->setSubject($user->getPrimaryEmail());
$serviceSendAs = new SendAs();
$serviceSendAs->setDisplayName($user->getFullName());
$serviceSendAs->setSignature($newSignature);
$serviceGmail = new Gmail($this->client);
return $serviceGmail->users_settings_sendAs->update($user->getPrimaryEmail(), $email, $serviceSendAs);
}
Thank ;)
I was running into the same issue and just figured out what's going on. For some Gmail accounts, the signature was updating and assigning both the "Compose" and "Reply/Forward" settings correctly, but for others, it was creating a new signature and only updating the "Compose" setting.
What I found was if I deleted all saved signatures for the accounts that were not updating the "Reply/Forward" setting and then ran the script, the signatures got created and both the "Compose" and "Reply/Forward" settings were set. Subsequent runs of the script also reflected correctly.
This is likely a bug since the API documentation explicitly states it will only update the "Compose" setting, but a favorable bug for sure.
Hope this helps!
Related
I am using the gabrielbull ups api wrapper and it is working fine, except when I want to add an UPS access point; the documentation says I have to declare a "AlternateDeliveryAddress". The access point data should then be printed on the ups label, but they are not appearing.
Since there isn't an example for this case on the wrapper GitHub page, I searched for methods on my own and found one but I have the feeling I forgot something since I don't receive any errors. I tried this code for the specific part. The surrounding code is like in the shipping class example
$address = new \Ups\Entity\Address();
$address->setAddressLine1($ap_addressline1);
$address->setPostalCode($ap_postal);
$address->setCity($ap_city);
$address->setCountryCode($ap_country);
$alternateTo = new \Ups\Entity\AlternateDeliveryAddress;
$alternateTo->setAddress($address);
$alternateTo->setUpsAccessPointId($ap_id);
$alternateTo->setName($ap_name);
$alternateTo->setAttentionName($ap_name);
$shipment->setAlternateDeliveryAddress($alternateTo);
Edit: I got this info of setting up the accesspoint from UPS support. The guy told me to set an alternate address with the AccessPoint data that will be printed at the bottom line of the label (where it's currently missing). If I misunderstood something (though we did a video conference and he showed me the result) and you know another way, feel free to tell me.
Ok after re-reading the official docs I found out what was missing.
If you want to use an accesspoint as address you also have to set the Indication Type via setShipmentIndicationType. There are 2 codes: 01 and 02 depending on the way you want to send it. Ofcourse I didn't add them before...
I haven't finished it yet because I get some errors but that's more about what information ups needs from me and so on. At least I can work with that.
As I mentioned in my initial post I used the example of the api wrapper as base and insert the required part before the request was send:
...
// Set Reference Number
...
// this is the part where you set shipment indication type for the accesspoint
$accesspoint = new \Ups\Entity\ShipmentIndicationType;
$accesspoint->setCode(Ups\Entity\ShipmentIndicationType::CODE_HOLD_FOR_PICKUP_ACCESS_POINT); // for "01"
#$accesspoint->setCode(Ups\Entity\ShipmentIndicationType::CODE_ACCESS_POINT_DELIVERY); // for "02"
$shipment->setShipmentIndicationType($accesspoint);
// Set payment information
...
// Ask for negotiated rates (optional)
...
// Get shipment info
...
I'm trying to create a page where users within my NGO can login using their GSuite Account. Their group membership is going to determine which parts of the page they can see. When I was younger I used to write my scripts in php, I guess I'm super old school with that nowadays but it's the only thing I can do :D
To retrieve the group memberships I have the following code:
config:
require_once "GoogleAPI/vendor/autoload.php";
$gClient = new Google_Client();
(...)
$gClient->addScope("https://www.googleapis.com/auth/plus.login");
$gClient->addScope("https://www.googleapis.com/auth/userinfo.email");
$gClient->addScope("https://www.googleapis.com/auth/admin.directory.group.readonly");
$gClient->addScope("https://www.googleapis.com/auth/admin.directory.group");
$gClient->addScope("https://www.googleapis.com/auth/admin.directory.user");
callback-file:
$oAuth = new Google_Service_Oauth2($gClient);
$userData = $oAuth->userinfo_v2_me->get();
$gruppen = new Google_Service_Directory($gClient);
$optParams = array('userKey' => $userData['id']);
$retGruppen = $gruppen->groups->listGroups($optParams);
$userData returns me the all the data i want about the user. That works quite fine.
The problem is calling the method "listGroups". And I get quite a weird response.
With the account I'm regulary using it works without any problems. I created a test account though - and this account doesn't seem to work at all.
The developers console shows me that I get a code 403 but that's weird cause it still works with one account and it doesn't with the other.
Through various var_dumps i found out that
var_dump($gruppen->groups->listGroups($optParams));
works for all cases, while it doesn't work anymore in the test account's case as soon as i add the method "->listGroups($optParams)"- but in the regular accounts case it does
I am trying to add a Logic Hook for Emails synced from IMAP Mail server.
In the end i want trigger a hook when a new mail gets synced and check the senders mail if its saved in one of the accounts.
The problem is that the Synced Mails dont get saved (at least not in InboundMail or Emails module) so the after/before_save does not trigger.
Here is my hook from logic_hooks.php:
$hook_array['after_save'][] = Array(1, 'Create Lead', 'custom/modules/InboundEmail/LeadLogicHook.php', 'LeadLogicHook', 'handleLead');
It does not work in InboundEmail and Email Module.
And the LeadLogicHook:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class LeadLogicHook
{
function handleLead($bean, $event, $arguments)
{
_ppl("Test");
}
}
Is this even possible with logic hooks?
EDIT: Added some Code
No need for logic hook or any other custom code. Sugar/SuiteCRM use a scheduler job to fetch email from IMAP server. You can check scheduler job function (function::pollMonitoredInboxes) which fetch emails. That contain code which is used for email fetching. track back code and you will find everything you want.
What version of sugar are you using?
You can, for example, generate an after_save hook in the E-mail module instead of inboundEmail
Would be like this:
$hook_array ['after_save'] [] = Array (1,'Create Lead','custom/modules/Emails/LeadLogicHook.php','LeadLogicHook','handleLead');
Do this and see if the email fires!
Another possibility would be to use the after_relationship_add, because usually, the email is associated with some lead, account, or contact. try to create a hook in the module that your email is associating with and generate the operation from there
one last possibility (I do not recommend this) is to create a trigger in your database for when the data enters the table, perform the check and take some action
I think it's possible, if after/before_save not triggering then try some similar logic hooks. The following are some logic hooks that I think could help.
before_retrieve
after_retrieve
before_restore
after_restore
server_roundtrip
after_session_start
after_entry_point
Comment if you want more details, like how to use logic hooks e.t.c.
Objective: Autopopulate some values using the tabLabel/value key pair for server templates, using the beta Docusign PHP Client.
I've looked at quite a few stackoverflow posts and unfortunately the one that seems to be the closest related to me seems unanswered: Docusign API - prefilling tab values on envelope created from template
I was unable to find this "SecureField" option in any sort of preferences.
Currently, the name field fills in automatically just because of the template role being set accurately. I didn't have to do this with the tabLabel key, this was done automatically. I have tried creating a company tab, and that fails to autopopulate, so does a random text tab I have tried.
I have currently forked the library and made it PSR-4 compatible, and to achieve this objective I changed the following files:
TemplateRole Model: Modified the constructor to include $tabs, and set $this->tabs if $tabs is set. I added two functions getTabs()/setTabs($tabs) that behave the same as get/set RoleName, Name, Email, etc.
RequestSignatureResource: In the foreach ($templateRoles as $templateRole) I added a 'tabs' key to the array_pusy, and put $templateRole->getTabs().
I created a new TemplateRole('role name', 'person name', 'email', $tabs).
I can see the tabs in the JSON request data. Is there anything I'm missing?
I should also note that I used this post for inspiration, too: How to pre-fill tabs on a server template with the DocuSign API. The issue with this is that if I put textTabs:{text:{tabLabel:"something", value:"some value"}} then I get a response from the API that my request was invalid. I can provide that specific error upon request if needed.
The following worked for me :
$templateRole = new DocuSign\eSign\Model\TemplateRole();
$templateRole->setClientUserId($email);
$templateRole->setEmail($email);
$templateRole->setName($recipientName);
$templateRole->setRoleName($templateRoleName);
$textTab = new \DocuSign\eSign\Model\Text();
// I added this text field manually on docuSign site.
$textTab->setTabLabel("Field Label");
$textTab->setValue('Value');
$tabs = new DocuSign\eSign\Model\Tabs();
$tabs->setTextTabs(array($textTab));
$templateRole->setTabs($tabs);
I am making an application in CodeIgniter and I need a Messaging Library Module there and I got a Library name Mahana. The Link is as follows.
https://github.com/jrmadsen67/Mahana-Messaging-library-for-CodeIgniter/tree/master/application
But I am unable to apply it as it has no controller and View portion. I am very new to CodeIgniter. Can any one provide me any link of total Mahana Librery or any other Messaging Library for CodeIgniter
Thank You
What's your problem ?
First you must create in the db, the tables from the dump mahana.sql,
and after use the variable that are in the configuration file config/mahana.php (USER_TABLE_TABLENAME, USER_TABLE_ID, and USER_TABLE_USERNAME) to integrate with a fast table access.
To use the library just put in your controller :
$this->load->library('mahana_messaging');
after that, when you want to get a message, create an object, and put in the method *get_message* the message id, and sender id, it will return a single message, including the status for specified user.
$mahana = new Mahana_messaging();
$msg = $mahana->get_message($msg_id, $sender_id);
U can also get the full thread of conversation using the method *get_full_thread*, it will return a entire thread conversation. To send a new internal message, that create a new thread, you must use the method *send_new_message* and pass the sender id, the recipient, the subject, the body, and finally the priority (this information, usually will be get from a web form, that you have created previously)
function send_new_message($sender_id, $recipients, $subject='', $body='', $priority=PRIORITY_NORMAL)
and so on ... there are other functions that permit you to reply a message, get partecipant...
Good work
Does this help at all????