-1

So I'm trying to execute a Lambda function based on the value of a contact attribute (checked by a Check Contact Attributes clock) that I set on the previous contact flow. My question is, are the contact attributes local to the contact flow or can they be referenced from the next contact flow? Right now it's not working for me, when I check the contact attribute value it never matches with the value that is supposed to have been set (I check this after setting it in the previous contact flow).

Also getting this from the Lambda function that is checking the value (existingCase is the name of the Contact Attribute):

'existingCase': KeyError Traceback (most recent call last): File "/var/task/lambda_function.py", line 11, in lambda_handler print("Is it existing case " + event["Details"]["ContactData"]["Attributes"]["existingCase"]) KeyError: 'existingCase'

Thanks!

the_ccalderon
  • 2,006
  • 2
  • 13
  • 24

2 Answers2

1

Contact Attributes are specific to a call/contact. An attribute that is set in one contact follow can’t be accessed by another Contact Flow. Likewise, attributes are no longer available to a Contact Flow after the call/contact ends (even if it is the same calling party).

If you need the attributes to be available to subsequent contacts from the same customer endpoint, you would need to call a lambda function and store the attributes in an external data store, like DynamoDB, using the customer’s phone number (or some other identifier specific to the customer/caller) as the key. In the beginning of your Contact Flow, you could invoke another lambda function that searches dynamo using the customer endpoint (customer’s phone number) and restores the attributes from the previous contact using the data in dynamo. This effectively scopes the contact attributes to the customer, rather than the contact.

NOTE: this is just an example to illustrate the scope of the attributes and should not be used in a production scenario, as many caller may be seen as having the same endpoint (phone number).

Aossey
  • 850
  • 4
  • 13
  • actually the attributes do get transferred from the first contact flow to a customer queue flow however, they do not get transferred from the last to a next contact flow. Also see: https://forums.aws.amazon.com/thread.jspa?messageID=883389󗪽 – the_ccalderon Jan 02 '19 at 18:43
  • 1
    I agree, the scope of the attributes is limited the life of the contact. I have updated the answer to include a suggested solution for making the attributes available to subsequent contacts, if that is your goal (unclear from the question). – Aossey Jan 03 '19 at 04:46
1

It is possible to transfer Contact attributes from one contact flow to another contact flow using a user-defined type. Set the contact attributes using two below methods:

  1. Use Text: Set key and value, and in the next contact flow use contact attributes of type User Defined with the key defined in the previous flow.
  2. Use Attributes: Set Key and value along with type as User Defined. In the next contact-flow use contact attributes of type User Defined with the key defined in previous flow.
Sanjay
  • 13
  • 5