[C# SDK] Storing a user's last access February 09, 2023 18:31 Updated Imagine that your challenge is to store the last time your user used a certain chatbot service. For this, we will need: Create the BLiP C# SDK template project (see how in the BLiP documentation) Add the IBucketExtension interface to your MessageReceiver's constructor. Note: It will be injected automatically by the SDK. Use the SetAsync(string resourceId, Document d) method to store a document containing the last access date. Note: Use the GetAsync(string resourceId) method to retrieve previously saved information. The code below shows how to save a json document containing the last accessed date. public class BucketMessageReceiver : IMessageReceiver{ private readonly IBucketExtension _bucketExtension; private readonly IMessagingHubSender _sender; public BucketMessageReceiver(IMessagingHubSender sender, IBucketExtension bucketExtension) { _bucketExtension = bucketExtension; _sender = sender; } public async Task ReceiveAsync(Message message, CancellationToken cancellationToken) { //Store last access date var jsonLastAccess = new JsonDocument(); jsonLastAccess.Add("lastAccessDate", DateTimeOffset.Now); await _bucketExtension.SetAsync(message.From.ToString(), jsonLastAccess); //Get last access date await _bucketExtension.GetAsync<JsonDocument>(message.From.ToString()); }} For more information, visit the discussion on the subject in our community or the videos on our channel. 😃 Related articles How to build bots using SDKs or HTTP API How to reset users through Beholder? How does redirection between subbots work? Creating interactive messages in WhatsApp [SDK C#] Track of Users who used a certain functionality