Salesforce is not able to get docusign authentication failure event - salesforce

I have enabled recipient failure event in triggered event in docusign.but still i didn't receive any reference in Salesforce after authentication failure at recipient end

You need to set a Recipient Event for failed delivery similar to an envelope event
RecipeintEvent event = new RecipientEevnt();
event.setRecipientEventStatusCode("AutoResponded");
event.setIncludeDocuments("false");
Or you can activate it in your connect configuration under recipient events

Related

Logic App send Event to Event Hub - Status 404

I try to get familiar with Azure logic apps therefor I try some simple things like receive request connect to database and / or event hub.
In case of send an event to an event hub I get the following error
{"statusCode":"BadRequest","body":{"code":"ServiceProviderActionFailed","message":"The service provider action failed with error code 'BadRequest' and error message 'Put token failed. status-code: 404, status-description: The messaging entity 'sb://eventhubXX.servicebus.windows.net/eventhubXX/myeventhub' could not be found. To know more visit https://aka.ms/sbResourceMgrExceptions. TrackingId:1234567-1234-1245-1254-1234562345_G15, SystemTracker:evneventhub01.servicebus.windows.net:eventhubxx/myeventhub, Timestamp:2021-09-15T08:41:35.'."}}
I copied the Connectionstring from the EventHub and pasted it into the Logic App.
and I can't figure out what the problem is.
Please help and/or give me a hint.
Thx!
According to Serkant Karaca, 'eventhubXX/myeventhub' is not a valid eventhub name. Eventhub name should not include '/'.
To get the connection string from the Azure Event Hubs, refer this MsftDocumentationSteps
For more details on how to send/receive events from and to the event hubs - refer this # Send events to and receive events from Azure Event Hubs

How do I refresh the token in a cometd client talking to a Salesforce Platform EventBus?

I'm using cometd to listen to platform events generated in Salesforce. My cometd client configuration code looks like
this.client.configure({
url: `${this.org.instance_url}/cometd/46.0`,
requestHeaders: {
Authorization: `Bearer ${salesforceToken}`
},
appendMessageTypeToURL: false
});
where the salesforceToken is obtained using the refresh token. This all works fine for a while but if there are no events for a considerable period of time (anecdotally anywhere between 6-24 hours), then my client seems to expire and no events are received. If I refresh the token and restart my listener, things start working again.
Is there a way to keep the listener active other than writing some sort of timer to restart the process every few hours after inactivity ?
You do not have to refresh the token again
Whenever there is no activity on the channel, the server closes the connection after a specific time.
In that time client receives a 403 (Unknown client) status code, and the client has to handshake again withing 110 seconds.
By default, CometD tries to reconnect without any user interaction and If the client doesn't reconnect within the expected time, the server removes the client's CometD session.
Once the connection gets reconnect, all the channel subscriptions will be removed by ComedD, and we have to subscribe to the channel again in order to receive events.
In order to do so, we have to make use of meta/Handshake callback to resubscribe to the channel again.
see https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/using_streaming_api_client_connection.htm, paragraph "After Invalid Authentication"
"Streaming API regularly validates the OAuth token or session ID while the client is connected. If client authentication is not valid, the client is notified with the 401::Authentication invalid error and an advice field containing reconnect=none. After receiving the error notification in the channel listener, the client must reauthenticate and reconnect to receive new events."

Powerforms submit - getting Docusign Envelope ID

We are incorporating Powerforms into a Salesforce Community. When a user completes a Powerform, we need to execute a trigger to write back to Salesforce.
My questions are related to attaching the completed Docusign envelope to the related Salesforce record:
1) When we redirect from Powerforms, will we get the Docusign envelope ID?
2) If so, can we insert a Docusign envelope record in Salesforce with that ID with the standard AppExchange package to tie the envelope to the record in Salesforce from which the Powerform was initiated?
Any thoughts would be much appreciated.
Thanks,
Mike
If you're logged into DocuSign: Go To Admin>> Signing Settings>> In-Session Landing Pages
In-Session Landing Pages is used by Powerform to redirect the signer to the URL where you want Signer to redirects to. When Signer gets redirected then DocuSign populates URL like below:
{RedirectUrl}/?env={envelopeId}&pf={powerformId}&r={recipientId}
Alternatively and also recommended is to use DocuSign Connect, where you subscribe for the event like Envelope Completed or Recipient Signed etc, once event occurs then DocuSign will push an XML message to your configured listener with the envelope related details. This is a better approach because with redirect there is a risk of the customer closing the browser or browser getting crashed before browser hits your app URL.

How to execute custom code after successful authorization?

Client app is redirecting to IdentityServer4 instance - "/connect/authorize/callback"?client_id=...".
If the user is not logged in(has no cookie) he is redirected to the Login page and on postback I can execute random logic(subscribe the user to this client - add claim to the user's claims collection with the client_id).
If the user has valid cookie there is no login screen and IdentityServer4 redirects him back to the Client app with the requested tokens in the query string (the consent is turned off).
How can I execute custom code when this event occurs?
A "login success" event is available from the Built-In Events. Unfortunately, Identity Server events are logging-oriented, so you must implement IEventSink to capture events, and you probably can't do things like show UI without interrupting the rest of the OIDC flow. This also means you can't log events unless you manually handle it in your IEventSink implementation (see the DefaultEventSink, it just serializes the event to whatever logger is registered for injection). The event is raised by the TokenRequestValidator.
First, enable "success" events in the configuration...
services.AddIdentityServer(options =>
{
options.Events.RaiseSuccessEvents = true;
});
...then look for the UserLoginSuccessEvent.
public class LoginEventSink : IEventSink
{
public Task PersistAsync(Event evt)
{
if(evt.Id.Equals(EventIds.UserLoginSuccess))
{
// do stuff
}
}
}
One of the overloads tells you whether the login was interactive by setting Event.Endpoint to UI but I don't see a way to get that from IEventSink, not really sure how it's used. You might be able to check the OIDC "Prompt" mode for None if you need that.
Depending on your setup and requirements, you could also capture an event on the client side when the challenge returns, but it sounds like you want to keep this in Identity Server.

Stop notification for google watch when token is expired

Here is the situation.
User is connected to our application and we have authenticated him with google calendar to start Watch for any event on his calendar.
We have stared getting the event notification but now User access token is expired and we are not sure when user will re-authenticated him self with our app.
But we are still getting the notifications, which we want to stop, but we are unable to stop the Watch because his access token is expired.
Is there any way we can stop the Watch with above mention scenario?
Thanks in Advance
The notifications should stop automatically in expiration time. You can choose to stop receiving notifications for a particular channel before it expires by calling the stop method at the following URI:
https://www.googleapis.com/calendar/v3/channels/stop
This method requires that you provide at least the channel’s id and the resourceId properties, as shown in the example below.
POST https://www.googleapis.com/calendar/v3/channels/stop
Authorization: Bearer {auth_token_for_current_user}
Content-Type: application/json
{
"id": "4ba78bf0-6a47-11e2-bcfd-0800200c9a66",
"resourceId": "ret08u3rv24htgh289g"
}
Check this documentation on how to stop notifications.

Resources